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的模板项目了

  • 相关阅读:
    [程序员代码面试指南]栈和队列-单调栈结构(单调栈)
    快学Scala第一部分
    Add Digits
    Nim Game
    将分布式中多台节点的日志信息集中到一个节点上
    Eclipse调试的一些小技巧
    Maven的常用命令
    Eclipse插件本地扩展安装
    Spark应用程序的运行框架
    Spark运行各个时间段的解释
  • 原文地址:https://www.cnblogs.com/lcyhjx/p/6166255.html
Copyright © 2011-2022 走看看