EntityFramework.SqlServer.dll not is getting added to the published folder only when I publish in RELEASE mode

后端 未结 3 2038
说谎
说谎 2021-01-02 03:19

I know there is a problem with EF6 EntityFramework.SqlServer and included var type = typeof(System.Data.Entity.SqlServer.SqlProviderServices); in context const

3条回答
  •  心在旅途
    2021-01-02 03:43

    Don't know why; but adding this method to your context will make your project copy the dll

    private void FixEfProviderServicesProblem()
            {
                // The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
                // for the 'System.Data.SqlClient' ADO.NET provider could not be loaded. 
                // Make sure the provider assembly is available to the running application. 
                // See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
                var instance = System.Data.Entity.SqlServer.SqlProviderServices.Instance;
            }
    

    Tested and working Reference: Entity Framework Provider type could not be loaded?

提交回复
热议问题