Recently found a framework for DDD
Looks good, it's said to be very bad.
It's going to be nice to have a little something to try out recently.
Struggling to afford to buy high-distribution server, had to install MySQL database
Here's how to use MySQL database in this framework
After you open the project, select * in Package Manager control platform. Entityframwork and *. Web Project (* The prefix for your project name)
Install-package MySql.Data.Entity//install-package MySql.Data.Entity -command to install MySql.Data.Entity components
Enter the above statement to install MySQL related components
Then change the connection string
<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"/>//can be seen here as well as automatically referencing MySQL related items for us <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=root"/></connectionstrings>
Then update the database in package management control platform
Update-database–verbose
At this point, we can use the project to connect to the MySQL database.
In practice, there are often unexpected problems
Here's a few small questions I've met myself.
1, update the database prompt "Specified key was too long; Max key length is 767 bytes"
This problem is generally due to (I think, welcome Dalao Guidance) Database generator configuration is not correct, the relevant configuration of MSSQL in MySQL is not all applicable
The type of the generator needs to be specified on the DbContext class
[Dbconfigurationtype (typeof(MySql.Data.Entity.MySqlEFConfiguration))] Public class mycontext:dbcontext{}
Here's mycontext for your EF-related classes
2, forget, remember to write it again
How to use MySQL database in ABP framework and related issues