You need to change the project to MySQL because you want to deploy the project to the cloud server and do not want to install SQL Server on the servers.
Initialization of projects
1, download the project compression package, the previous article has said, you can add to the group file download. Unzip the downloaded project source, open the project using VS2015
Here you need to restore the package, choose the solution---Right-click (Restore NuGet Package), now restore NuGet package is much faster than before, this is the credit of Microsoft attaches importance to Chinese developers.
After the package has been restored, click the solution to regenerate it again. You can see that the project builds successfully and then go to the Modify MySQL database step.
Note: If you do not want to use the MySQL database, you can skip the following steps and go directly to the database creation step.
Installing the MySQL Package
Before you install the MySQL database, install the MySQL database on your computer to ensure that your computer can successfully connect to the MySQL database.
MySQL Free Install environment configuration tutorial: http://www.jb51.net/article/83636.htm
Then install the MySQL package, both entityframework and Web projects need to be installed
The installed NuGet package is already tagged with and which project is installed, here Select the 6.9.10 version
Web Project
Open Web. config to modify the connection string
<connectionStrings> <!--<add name= "Default" connectionstring= "server=localhost; Database=abpzerotemplate; trusted_connection=true; "Providername=" System.Data.SqlClient "/> - <!--MySQL Connection string - <Addname= "Default"connectionString= "Data source=localhost;port=3306;initial catalog=pdddb3.4;uid=root;password=ab12; Charset=utf8 "ProviderName= "MySql.Data.MySqlClient" /> <Addname= "Abp.Redis.Cache"connectionString= "localhost" /> </connectionStrings>
Install MySQL Driver
Install MySQL driver, driver version Select the same version as the package installed above
Drive: https://dev.mysql.com/downloads/connector/net/
After the download has been the next installation is ready.
EntityFramework Project
Modify the configuration constructor under the EntityFramework item
File path: D:\ABP version\aspnet-zero-3.4.0\aspnet-zero-3.4.0\src\mycompanyname.abpzerotemplate.entityframework\ Migrations\configuration.cs
Public Configuration () { false; " abpzerotemplate " ; // Add the following code Setsqlgenerator ("MySql.Data.MySqlClient"new MySql.Data.Entity.MySqlMigrationSqlGenerator ()); // set SQL generator to MySQL }
Add an attribute to the Abpzerotemplatedbcontext class
File path: D:\ABP version\aspnet-zero-3.4.0\aspnet-zero-3.4.0\src\mycompanyname.abpzerotemplate.entityframework\ Entityframework\abpzerotemplatedbcontext.cs
[Dbconfigurationtype (typeof(MySql.Data.Entity.MySqlEFConfiguration))] Public class Abpzerotemplatedbcontext:abpzerodbcontext<tenant, Role, user> {
Regenerate migration files
At this point the code is added, rebuild the migration file, you can see the original project there are many migration files, we do not want these files, rebuild themselves.
Delete the remaining seed directory and configuration file
Note: Set the Web project as the startup Project first
Open the Package management console for VS and select it in the package management console. EntityFramework Project as the default project. Then execute the following command in the console:
" abpzero_initial "
See a yellow hint stating the creation of the migration file succeeded
At the same time the Migrations directory has one more file, this is the migration file that was just created.
Now you can use the following command to create the database:
Update-database
All of the things have been done and now you can run your project and use the MySQL database.
This file tells you how to start a project, it is recommended to deploy to IIS startup, and in future articles I will start with IIS.
Http://www.cnblogs.com/shensigzs/p/6258835.html
Return to total directory
2, Abpzero Series Tutorial of the more Sellers tool change the database for MySQL