Issue while setting up the project
See original GitHub issueI downloaded earlier release for .net core 2.1 and started making changes as per the readme file. I observed an error while running the command. I am pasting the entire errors here- Microsoft Windows [Version 10.0.17134.1184] © 2018 Microsoft Corporation. All rights reserved.
C:\Project\Sonar\Sample Application.NET Core Applications\eShopOnWeb-netcore2.1\eShopOnWeb-netcore2.1\src\Web>dotnet ef database update -c catalogcontext -p …/Infrastructure/Infrastructure.csproj -s Web.csproj
info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 2.1.14-servicing-32113 initialized ‘CatalogContext’ using provider ‘Microsoft.EntityFrameworkCore.InMemory’ with options: StoreName=Catalog
System.InvalidOperationException: Unable to resolve service for type ‘Microsoft.EntityFrameworkCore.Migrations.IMigrator’. This is often because no database provider has been configured for this DbContext. A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.
at Microsoft.EntityFrameworkCore.Internal.InternalAccessorExtensions.GetService[TService](IInfrastructure1 accessor) at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure
1 accessor)
at Microsoft.EntityFrameworkCore.Design.DesignTimeServiceCollectionExtensions.<>c__DisplayClass1_0.<AddDbContextDesignTimeServices>b__7(IServiceProvider _)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.EnsureServices(IServiceProvider services)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_1.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Unable to resolve service for type ‘Microsoft.EntityFrameworkCore.Migrations.IMigrator’. This is often because no database provider has been configured for this DbContext. A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.
C:\Project\Sonar\Sample Application.NET Core Applications\eShopOnWeb-netcore2.1\eShopOnWeb-netcore2.1\src\Web>
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top GitHub Comments
Hi Fleming,
I haven’t been able to take a look at the suggestions. I will take couple of days to try out the suggestions as I am occupied with something else at this moment. I shall revert on this as soon as I try out the suggestions.
Thanks for following up.
Regards, Anantha
Get Outlook for Androidhttps://aka.ms/ghei36
From: Eric Fleming notifications@github.com Sent: Tuesday, February 4, 2020 3:06:25 AM To: dotnet-architecture/eShopOnWeb eShopOnWeb@noreply.github.com Cc: Anantha anantha.subramanian@outlook.com; Mention mention@noreply.github.com Subject: Re: [dotnet-architecture/eShopOnWeb] Issue while setting up the project (#351)
Hey @AnanthaSubramanianhttps://github.com/AnanthaSubramanian - have you had a chance to give this a try yet?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet-architecture/eShopOnWeb/issues/351?email_source=notifications&email_token=AKRTV5SV53A6IWSQNMY5IETRBCE5TA5CNFSM4KL3P2VKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKVPRUY#issuecomment-581630163, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKRTV5TH2SPUC7T7FLJFGA3RBCE5TANCNFSM4KL3P2VA.
Looks like you are trying to do migration against
InMemoryDatabase
.Make sure you,
InMemoryDatabase
)UseSqlServerDatabase
)Infrastructure
project inPackage Manager Console
.Apply Migrations
andUpdate Database
.