zoukankan      html  css  js  c++  java
  • 在ABP模板工程中使用MySql

    1 下载一个新的ABP模板项目

    http://www.aspnetboilerplate.com/  

    2 在Windows上安装MySql, 创建一个新的数据库 sampledb

    https://dev.mysql.com/doc/refman/8.0/en/mysql-installer-gui.html - MySql的安装文档
    https://downloads.mysql.com/archives/installer/ - mysql-installer-gui的下载地址

    3 打开模板项目,在EntityFramework和Web项目中安装 MySql.Data.Entity 

    Install-Package MySql.Data.Entity -Version 6.8.3 / Install-Package MySql.Data.Entity   - 安装MySql.Data.Entity组件的命令

    注意: 这里不要安装最新版本的MySql.Data.Entity, 因为模板项目使用的.net framework版本是4.5.2, 对应的MySql.Data.Entity的版本要使用6.8.3 , 如果使用最新的版本,后面会报错

    4 修改Web.config文件

    <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        <providers>
          <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices,          MySql.Data.Entity.EF6" />
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,          EntityFramework.SqlServer" />
        </providers>
      </entityFramework>
      
    <connectionStrings>
    <add name="Default" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;port=3306;database=sampledb;uid=root;password=*** " />
    </connectionStrings>

    关于Ef6 to MySql 可参考文档 http://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html

    5 在Package Manager Console中执行命令 Update-Database –Verbos

    6 现在就可以运行ABP的模板项目了

  • 相关阅读:
    excel生成csv后,0001变成1
    windows_server_2012_r2提示api-ms-win-crt-runtime-l1-1-0.dll 丢失
    py文件生成exe程序
    朴素贝叶斯分类(上)
    01 | 数据分析全景图及修炼指南
    BBS
    BBS
    BBS
    BBS
    BBS
  • 原文地址:https://www.cnblogs.com/lcyhjx/p/6166255.html
Copyright © 2011-2022 走看看