-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't do the database migration/update. #1
Comments
Hi Ron, |
Hi,
I'm trying to run your code but met a problem on creating the database schema through using code-first approach as fellowing:
PM> add-migration MicrosofteShopOnWebCatalogDbContext -context MicrosofteShopOnWebCatalogDbContext
To undo this action, use Remove-Migration.
PM> update-database -context MicrosofteShopOnWebCatalogDbContext
System.ArgumentException: GenericArguments[0], 'DotnetCrawler.Data.Migrations.MicrosofteShopOnWebCatalogDbContext', on 'Microsoft.EntityFrameworkCore.Design.IDesignTimeDbContextFactory
1[TContext]' violates the constraint of type 'TContext'. ---> System.TypeLoadException: GenericArguments[0], 'DotnetCrawler.Data.Migrations.MicrosofteShopOnWebCatalogDbContext', on 'Microsoft.EntityFrameworkCore.Design.IDesignTimeDbContextFactory
1[TContext]' violates the constraint of type parameter 'TContext'.at System.RuntimeTypeHandle.Instantiate(RuntimeTypeHandle handle, IntPtr* pInst, Int32 numGenericArgs, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.Instantiate(Type[] inst)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
--- End of inner exception stack trace ---
at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextFactory(Type contextType)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextTypes()
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextType(String name)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
GenericArguments[0], 'DotnetCrawler.Data.Migrations.MicrosofteShopOnWebCatalogDbContext', on 'Microsoft.EntityFrameworkCore.Design.IDesignTimeDbContextFactory`1[TContext]' violates the constraint of type 'TContext'.
The text was updated successfully, but these errors were encountered: