Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Mysql with DevArt Connector #3039


User avatar
0
cangunaydin created

Hello i am trying to implement mysql db using devart dotconnect provider. Since Mysql native connector brings up lots of problems with eager load i wanted to switch to another connector. Normally in their documentation they are not using defaultconnectionfactory instead of that they are using DbProviderFactories you can find the getting started doc from here: <a class="postlink" href="http://blog.devart.com/entity-framework-6-support-for-oracle-mysql-postgresql-sqlite-and-salesforce.html">http://blog.devart.com/entity-framework ... force.html</a>

when i have changed my dbconfiguration class according to the post i am getting an error from .net core cli when i try to add a migration. It is saying "keyword not supported for 'port'". It seems like it is still trying to use ms sql connection factory. Do you have any idea what can be the cause of the problem or what am i doing wrong? Thank you.

here is my dbconfiguration class and configuration constructor.

public class BookAndAdDbConfiguration : DbConfiguration
    {
        public BookAndAdDbConfiguration()
        {
            //Mysql Implementation
            //SetProviderServices("MySql.Data.MySqlClient", new MySqlProviderServices());
            //SetDefaultConnectionFactory(new MySqlConnectionFactory());

            SetProviderServices("Devart.Data.MySql", Devart.Data.MySql.Entity.MySqlEntityProviderServices.Instance);
            SetProviderFactory("Devart.Data.MySql", Devart.Data.MySql.MySqlProviderFactory.Instance);
            //SetProviderServices(
            //    "System.Data.SqlClient",
            //    System.Data.Entity.SqlServer.SqlProviderServices.Instance
            //);
        }
    }
public Configuration()
        {
            //SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
            SetSqlGenerator(MySqlConnectionInfo.InvariantName, new Devart.Data.MySql.Entity.Migrations.MySqlEntityMigrationSqlGenerator());
            AutomaticMigrationsEnabled = false;
            ContextKey = "BookAndAd";
        }

No answer yet!