Started to use the ABP framework to build the company's new projects, although everything is not set, but the soldiers did not move, fodder first, I will try the whole process, to better to win the opportunity.
This technology selection: ABP (ASP. NET core MVC) +mysql (8.0) +docker
ABP Website Address: https://aspnetboilerplate.com/
1. Installing MySQL-related packages in NuGet, the MySQL package provided by Oracle company is still problematic, so it is now used by third-party MySQL packages.
Pomelo. Entityframeworkcore. mysql
Pomelo.entityframeworkcore.mysql. Design
2, find xxdbcontextconfigurer in the Entityframeworkcore layer, modify the database configuration in the DbContext, SQL Server by default, and modify it to MySQL.
3. Modify the connection string, locate the Appsetting.json file under Web.host or WEB.MVC, and modify the connection string.
" Default " " server=xxx.xxx.xxx.xxx; database=surrounddb;charset=utf8;uid=root;pwd=123456; "
I installed a MySQL database directly under Docker in the server, so it will be used directly in the development environment.
4, start to update the database, you can delete the Migrations folder under the Entityframeworkcore layer does not affect, which is the version of the history of the database migration brought, not important to us.
Under Package Manager console, select Entityframeworkcore and start entering commands
Pm>add-migration name (Take one of the updated names)
Hint message: To-undo this action, use Remove-migration.
Pm>update-database
No errors will be prompted as follows:
Hint message: Applying migration ' 20180809141445_initall '.
Done.
5, start the website, successfully opened and connected, if the table structure changes, update the database, just run the previous two lines of command.
Attention:
1, my MySQL database version is higher than 5.7, the mysql5.7 will be reported some errors, such as: Specified key was too long; Max key length is 767 bytes and the like.
Because this version of MySQL uses different encoding methods, choose to upgrade version, by modifying the code of MySQL solution (79521812)
2. If Ssl=none is added to the connection string, the error will be removed.
2018-08-09, I hope I can come back and see my steps after the technology is successful
ABP Framework connects to MySQL database