locked
In Asp.net Core 3.1 application, db connection is not working with Microsoft.Practices.EnterpriseLibrary.Data RRS feed

  • Question

  • User-80134705 posted

    In my apt.net core application, database connection with enterpriselibrary is not working. i am getting the below error.

    Database provider factory not set for the static DatabaseFactory. Set a provider factory invoking the DatabaseFactory.SetProviderFactory method or by specifying custom mappings by calling the DatabaseFactory.SetDatabases method.

    appsettings.json file 

    "ConnectionStrings": {
    "MSSQLConnection": "data source=Test\\MSSQLSERVER2017; Initial Catalog = App1;User ID = sa ,Password=123; Trusted_Connection=True;",
    "providerName": "System.Data.SqlClient"
    }

    Below code is using in my application

    public DataTable GetDetails()
    {
    DbCommand objdbCmd;
    DataSet dsUsers = null;
    try
    {

    Database db;
    string connectionString = Configuration.GetConnectionString("MSSQLConnection");
    db = DatabaseFactory.CreateDatabase("MSSQLConnection");
    objdbCmd = db.GetStoredProcCommand("Select * from usermaster");
    dsUsers = db.ExecuteDataSet(objdbCmd);
    return dsUsers.Tables[0];
    }
    catch (Exception ex)
    {
    return null;
    }
    finally
    {
    objdbCmd = null;
    }

    }

    Please help.

    Wednesday, February 19, 2020 12:06 PM

All replies

  • User475983607 posted

    .NET is not compatible with Core 3.1. 

    Wednesday, February 19, 2020 12:27 PM
  • User-80134705 posted

    Is Asp.net core not work with Microsoft.Practices.EnterpriseLibrary.Data ?

    Thursday, February 20, 2020 4:34 AM
  • User1120430333 posted

    Is Asp.net core not work with Microsoft.Practices.EnterpriseLibrary.Data ?

    Entlib is developed using a non Core .NET Framework. A solution using  .NET Core Framework only works with a solution developed with the .NET Core Framework..

    Thursday, February 20, 2020 5:30 AM
  • User-854763662 posted

    Hi Hrishi K ,

    Maybe refer to the below link about  Enterprise Library for .Net Core 2.0 & .Net Standard 2.0

    https://github.com/Chavoshi/EnterpriseLibrary.NetCore

    For your issue, it is more related with Enterprise Library which is a third party product, I would suggest you submit your issue below:

    https://github.com/Chavoshi/EnterpriseLibrary.NetCore/issues 

    Best Regards,

    Sherry

    Thursday, February 20, 2020 9:50 AM