I have worked with other migration projects and had no problem. in my current project i seperated the migration and model projects. I get the following error when adding migration or even when enabling migration (the configuration class is created):
PM> enable-migrations -Force No classes deriving from DbContext found
in the current project. Edit the generated Configuration class to
specify the context to enable migrations for.
System.Reflection.ReflectionTypeLoadException: Unable to load one or
more of the requested types. Retrieve the LoaderExceptions property
for more information. at
System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at
System.Reflection.RuntimeModule.GetTypes() at
System.Reflection.Assembly.GetTypes() at
System.Data.Entity.ModelConfiguration.Mappers.TypeMapper.<.ctor>b_1(Assembly
a) at System.Linq.Enumerable.d_142.MoveNext()1.InsertRange(Int32 index,
at System.Collections.Generic.List
IEnumerable1 collection) at2.GetValue(TInput input) at
System.Data.Entity.ModelConfiguration.Mappers.TypeMapper..ctor(MappingContext
mappingContext) at
System.Data.Entity.DbModelBuilder.MapTypes(EdmModel model) at
System.Data.Entity.DbModelBuilder.Build(DbProviderManifest
providerManifest, DbProviderInfo providerInfo) at
System.Data.Entity.DbModelBuilder.Build(DbConnection
providerConnection) at
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext
internalContext) at
System.Data.Entity.Internal.RetryLazy
System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at
System.Data.Entity.Internal.LazyInternalContext.get_CodeFirstModel()
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext
context, XmlWriter writer) at
System.Data.Entity.Migrations.Extensions.DbContextExtensions.<>c_DisplayClass1.b_0(XmlWriter
w) at
System.Data.Entity.Migrations.Extensions.DbContextExtensions.GetModel(Action`1
writeXml) at
System.Data.Entity.Migrations.Extensions.DbContextExtensions.GetModel(DbContext
context) at
System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration
configuration, DbContext usersContext) at
System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration
configuration) at
System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration
migrationsConfiguration) at
System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
Unable to load one or more of the requested types. Retrieve the
LoaderExceptions property for more information.
Thanks
The message says that you have no class deriving from DbContext which means that you need to define one.
Something like this: