Base solution for your next web application
Open Closed

Entity Framework - MySql Integration with ASP.NET CORE #2818


User avatar
0
velu created

How to configure Mysql connection in ASP.NET CORE + ANGULAR 2.X?

Entity Framework - MySql Integration with ASP.NET CORE + ANGULAR 2.X


15 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can use this document <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/EF-MySql-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a>. It is for ASP.NET MVC 5.x but you just need to use

    dotnet ef migrations add "AbpZero_Initial"
    

    instead of

    Add-Migration "AbpZero_Initial"
    

    Open your command prompt, navigate to *.EntityFramework solution's root directory and run this command

    dotnet ef migrations add "AbpZero_Initial"
    

    in command prompt .

    Thanks.

  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    You can use this document <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/EF-MySql-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a>. It is for ASP.NET MVC 5.x but you just need to use

    dotnet ef migrations add "AbpZero_Initial"
    

    instead of

    Add-Migration "AbpZero_Initial"
    

    Open your command prompt, navigate to *.EntityFramework solution's root directory and run this command

    dotnet ef migrations add "AbpZero_Initial"
    

    in command prompt .

    Thanks.

    I am not able to connect Mysql server. How to use Mysql server connection.

  • User Avatar
    0
    velu created

    Please provide us Mysql Integration With Asp.Net Core step by step details.

  • User Avatar
    0
    ismcagdas created
    Support Team

    This document contains step by step instructions <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/EF-MySql-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a>. Did you try it ? Do you get an error ?

  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> This document contains step by step instructions <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/EF-MySql-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a>. Did you try it ? Do you get an error ?

    Which package is required for mysql integration with Asp. Net core 1.x and angular 2.x.

    Where can i add drivers

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You need to add this package to your project <a class="postlink" href="https://www.nuget.org/packages/MySql.Data.Entity/">https://www.nuget.org/packages/MySql.Data.Entity/</a>. It's explained in the document.

    I think you already have MySql installed, right ? If you haven't install MySql Connecter, you can install it here <a class="postlink" href="https://dev.mysql.com/downloads/connector/net/">https://dev.mysql.com/downloads/connector/net/</a> but this is not related to AspNet Zero, it is required for any other Entity Framework project.

    Thanks.

  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    You need to add this package to your project <a class="postlink" href="https://www.nuget.org/packages/MySql.Data.Entity/">https://www.nuget.org/packages/MySql.Data.Entity/</a>. It's explained in the document.

    I think you already have MySql installed, right ? If you haven't install MySql Connecter, you can install it here <a class="postlink" href="https://dev.mysql.com/downloads/connector/net/">https://dev.mysql.com/downloads/connector/net/</a> but this is not related to AspNet Zero, it is required for any other Entity Framework project.

    Thanks.

    We are using Asp. Net core 1.x and angular 2.x solution.

    I think MySql.Data.Entity not supported for Asp.net Core. MySql Connecter is not available for Visual Studio 2017.

    Please provide the proper solution for Mysql connectivity with Asp. Net core 1.x and angular 2.x .

    Please consider as Urgent.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think MySql.Data.Entity not supported for Asp.net Core.

    Actually, it is related to EntityFramework rather than ASP.NET Core. We use EntityFramework 6.x in all versions of ASP.NET Zero, so it should not be related to that.

    Did you try to implement the solution offered in documentation ? And did you get an error ? If you can explain where it failed for you, we can try to help.

    Thanks.

  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    I think MySql.Data.Entity not supported for Asp.net Core.

    Actually, it is related to EntityFramework rather than ASP.NET Core. We use EntityFramework 6.x in all versions of ASP.NET Zero, so it should not be related to that.

    Did you try to implement the solution offered in documentation ? And did you get an error ? If you can explain where it failed for you, we can try to help.

    Thanks.

    We are getting error keyword 'Port' is invalid. If you are having example with mysql connectivity for Asp.net core. Please provide us.

    We are successfully connected to Mvc 5.x and Angular 1.x. But able to achieve in Asp.net Core and Angular 2.x

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you try to change your DbConfiguration and Configuration classes like below:

    1. DbConfiguration class (Change MySqlTest with your project's name)
    public class MySqlTestDbConfiguration : DbConfiguration
    {
        public MySqlTestDbConfiguration()
        {
            SetDefaultConnectionFactory(new MySql.Data.Entity.MySqlConnectionFactory());
            SetProviderServices("MySql.Data.MySqlClient",
                        new MySqlProviderServices());
        }
    }
    
    1. Configuration class's constructor
    public Configuration()
    {
        SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
        
        AutomaticMigrationsEnabled = false;
        ContextKey = "MySqlTest";
    }
    

    After these steps delete all migration files and generate a single migration file using

    dotnet ef migrations add "AspNetZero_Initial"
    

    Then update database

    dotnet ef database update
    

    I hope this helps you.

  • User Avatar
    0
    velu created

    We are getting below mentioned error.

    "System.NotSupportedException: 'Unable to determine the provider name for provider factory of type 'MySql.Data.MySqlClient.MySqlClientFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.'"

    We are using "MySql.Data.Entity and Entity Framework" nuget package.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Did you added this nuget package <a class="postlink" href="https://www.nuget.org/packages/MySql.Data.Entity/">https://www.nuget.org/packages/MySql.Data.Entity/</a> to your Web and EntityFrmework project ?

    If yes, then please send your project to <a href="mailto:[email protected]">[email protected]</a> and we will take a look at it for you. Don't forget to remove bin, obj and packages folders before sending it.

    Thanks.

  • User Avatar
    0
    cangunaydin created

    Hello, Did you find any solution for this problem? @ismcagdas

  • User Avatar
    0
    cangunaydin created

    Ok i have found it. You need to install mysql connector for windows. If somebody have the same issue they can follow this link.

    <a class="postlink" href="https://dev.mysql.com/downloads/connector/net/">https://dev.mysql.com/downloads/connector/net/</a>

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @cangunaydin.