efcore icon indicating copy to clipboard operation
efcore copied to clipboard

'System.TypeLoadException. Method 'get_SqlGenerationHelper' in type 'Microsoft.Data.Entity.Storage.Internal.SqlServerDatabaseProviderServices'

Open takazm opened this issue 10 years ago • 11 comments

I am getting this following error in my ConfigureServices method of my Startup class, specifically, the line that I add EF to the DI Container: Method 'get_SqlGenerationHelper' in type 'Microsoft.Data.Entity.Storage.Internal.SqlServerDatabaseProviderServices' from assembly 'EntityFramework.MicrosoftSqlServer, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation. error

takazm avatar Dec 25 '15 22:12 takazm

@takazm What are the steps to reproduce this problem? It seems to be a misconfigured service.

Could you try to change this piece of code with the following code:

services
    .AddEntityFramework()
    .AddSqlServer()
    .AddDbContext<LeaseContext>(options => options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));

dnlruzzo avatar Dec 29 '15 19:12 dnlruzzo

Unfortunately that is no longer applicable in rc2-*. See screenshot ef7rc2

takazm avatar Dec 31 '15 13:12 takazm

Sorry, i just realized that i needed to add the an additional using statement to get the method ; using Microsoft.Data.Entity;

takazm avatar Dec 31 '15 13:12 takazm

I did modify as suggested and still get the error error22

takazm avatar Dec 31 '15 13:12 takazm

Inspect your dnx version and nuget feed. If the problem continues, try to reinstall VS2015 updates. Take a look at http://docs.asp.net/en/latest/getting-started/installing-on-windows.html

dnlruzzo avatar Dec 31 '15 19:12 dnlruzzo

I have been working on the same project since beta8 and it was running just fine so I'm convinced packages changed after rc1-final as it was my last known good run (currently on rc2-16357). I could go back to targeting rc1-final and see if it works.

takazm avatar Dec 31 '15 19:12 takazm

EntityFramework.SqlServer got renamed to EntityFramework.MicrosoftSqlServer. Are you still using the old one?

bricelam avatar Dec 31 '15 20:12 bricelam

No. I am not. Here's my packages file packages

takazm avatar Dec 31 '15 21:12 takazm

Thanks @bricelam. After uploading the screenshot I realized that one of my references for EF is targeting rc1. After updating it works now. packages2

takazm avatar Dec 31 '15 22:12 takazm

@takazm ok to close this one now?

rowanmiller avatar Dec 31 '15 22:12 rowanmiller

Yes please.

takazm avatar Dec 31 '15 23:12 takazm