- Install NuGet packages 'MySql.Data' v.8.0.16 and 'MySql.Data.Entity' v. 6.10.8
- Install MySQL connector Net 6.10.8
- INstall MySQL for Visual Studio 1.2.8
- Add Entity Data Model (Code First from database)
- New Connection (MySQL Data Provider)
- Modify the file 'App.config' for DB connection string
<connectionStrings>
<add name="MySqlModel" connectionString="server=redmine2.gorilla-technology.com;user id=root;password=linuxyes;persistsecurityinfo=True;database=redmine" providerName="MySql.Data.MySqlClient" />
<add name="Default" connectionString="host=192.168.60.162;port=5432;database=redminedb;user id=redmine;password=MYSQL-TEL#53519427" providerName="Npgsql" />
</connectionStrings>
All needed works are done and then DB operations are ready to go.
using( var context = new MySqlModel() )
using( var transaction = context.Database.BeginTransaction() )
{
...
}
沒有留言:
張貼留言