• Asp.Net MVC+BootStrap+EF6.0实现简单的用户角色权限管理3


    首先在webconfig中加入下面这句代码,这个主要是用来生成数据库的连接字符串

    <connectionStrings>
    <add name="AuthorDesignContext" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=AuthorDesign;Integrated Security=False;User Id=sa;Password=123456;MultipleActiveResultSets=True" />
    </connectionStrings>
    View Code

    并且要修改一下这段代码

      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
    View Code

    将原先5.0.0改为6.0.0

    接下来,就是要生成数据库了。首先打开工具下的点击程序包管理器控制台。

    然后输入Enable-migrations

    这时会在这里出现文件的,然后再次输入add-migration AddDatabase (注意:AddDatabase这只是一个名称,会生成一个文件的,名字是随便你的)输入指令之后我出现了如下错误这时因为我在AuthorDesignContext这个类中写错了,只需要将改回来即可。

    最后一步就是继续输入指定此时数据库就已经生成了。这就是我这生成的数据库。本篇到此为止。可能中间我有些部分讲的不清楚或者让你混乱的地方,可以提出来哦。我会改进的。

    百度源码下载地址

  • 相关阅读:
    rabbitmq无用使用guest用户远程连接
    SpringMVC 过滤器
    Spring MVC的Controller统一异常处理:HandlerExceptionResolver
    springMVC之mvc:interceptors拦截器的用法
    spring中排除某个类
    mysql中的CURRENT_TIMESTAMP
    [QT]Qt+VS2012+Win8 64Bit安装
    UOJ#55. 【WC2014】紫荆花之恋
    CodeChef SADPAIRS:Chef and Sad Pairs
    BZOJ4771: 七彩树
  • 原文地址:https://www.cnblogs.com/yjq-code/p/AuthoryDesign4.html
Copyright © 2020-2023  润新知