efcore icon indicating copy to clipboard operation
efcore copied to clipboard

An error occurred while calling method 'ConfigureServices' on startup class 'Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Error: The method or operation is not implemented.

Open AlexGnatuyk opened this issue 9 years ago • 2 comments

I'm want to use EF for COnfiguration data.

My statup.cs

namespace IdentityServer
{
    public class Startup
    {
              {
            services.AddMvc();

            var connectionString = @"Data Source=CR08186\\sqlexpress;Initial Catalog=IdentityServer;Persist Security Info=True;User ID=sa;Password=MsSql2008";
            var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;

            // configure identity server with in-memory users, but EF stores for clients and resources
            services.AddIdentityServer()
                .AddTemporarySigningCredential()
                .AddTestUsers(Config.GetUsers())
                .AddConfigurationStore(builder =>
                    builder.UseSqlServer(connectionString, options =>
                        options.MigrationsAssembly(migrationsAssembly)))
                .AddOperationalStore(builder =>
                    builder.UseSqlServer(connectionString, options =>
                        options.MigrationsAssembly(migrationsAssembly)));

        }
}

from cmd running dotnet ef migrations add InitialIdentityServerMigration -c PersistedGrantDbContext and dotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb

and have an error

An error occurred while calling method 'ConfigureServices' on startup class 'Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Error: The method or operation is not implemented. No DbContext named 'PersistedGrantDbContext' was found.

Any help would be appreciated!

AlexGnatuyk avatar Sep 13 '17 12:09 AlexGnatuyk

@AlexGnatuyk What versions of .NET Core, ASP.NET Core, and EF Core are you using?

ajcvickers avatar Sep 13 '17 16:09 ajcvickers

@ajcvickers I'm using .NET Core 1.1, ASP.NET Core 1.1.x, EF Core 1.1.x

AlexGnatuyk avatar Sep 14 '17 08:09 AlexGnatuyk