Microsoft.Data.Entity.Internal.DbContextServices.get_DatabaseProviderServices()Will object reference not set to an instance of an object.
Application startup exception: System.Reflection.TargetInvocationException: The goal of call exception occurred. ---> System.NullReferenceException: Will object reference not set to an instance of an object.
at Microsoft.Data.Entity.Internal.DbContextServices.get_DatabaseProviderServices()
at Microsoft.Data.Entity.Infrastructure.RelationalEntityFrameworkServicesBuilderExtensions.GetProviderServices(IServiceProvider serviceProvider)
at Microsoft.Data.Entity.Infrastructure.RelationalEntityFrameworkServicesBuilderExtensions.<>c.
resolved
i use
if (context.Database == null)
{
throw new Exception("DB is null");
}
replace
if (serviceProvider.GetService
@blueskybcl is there a chance you could provide repro code to help us make sure this isn't an issue in EF?
@divega I was in accordance with the practice of http://docs.asp.net/projects/mvc/en/latest/tutorials/mvc-with-entity-framework.html, the result is wrong “Next, we’ll create some sample data. Add a class named SampleData in the Models folder with the following code:”
error in class of SampleData
If it is me, please tell me.
Reopening so that we can see this in triage.
@divega ef version is 7.0.0.0-final-rc1
@divega source at https://github.com/blueskybcl/ContosoBooks