实体框架6迁移类库项目

时间:2016-10-23 14:24:47

标签: c# entity-framework entity-framework-6 ef-migrations

我有一个asp.net核心mvc项目的解决方案,它针对完整的.net框架和一个类库项目,包含我所有的域逻辑,实体,上下文以及所有这些,因为我希望拥有完整的EF6和我的核心mvc项目。我创建了所有实体类并模拟了他们的关系。我启用了成功的迁移并添加了我的第一次迁移,这也很顺利。发出命令update-database后,我收到此错误:

  

PM&GT;更新数据库       指定'-Verbose'标志以查看应用于目标数据库的SQL语句。       System.InvalidOperationException:Sequence不包含匹配元素       在System.Linq.Enumerable.Single [TSource](IEnumerable 1 source, Func 2谓词)       at System.Data.Entity.Utilities.DbProviderManifestExtensions.GetStoreTypeFromName(DbProviderManifest providerManifest,String name)       在System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.ConfigureColumn(EdmProperty列,EntityType表,DbProviderManifest providerManifest)       在System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.BinaryPropertyConfiguration.ConfigureColumn(EdmProperty列,EntityType表,DbProviderManifest providerManifest)       在System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(EdmProperty column,EntityType table,DbProviderManifest providerManifest,Boolean allowOverride,Boolean fillFromExistingConfiguration)       at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration。&lt;&gt; c__DisplayClass4.b__3(Tuple 2 pm) at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable 1 ts,Action 1 action) at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.Configure(IEnumerable 1 propertyMappings,DbProviderManifest providerManifest,Boolean allowOverride,Boolean fillFromExistingConfiguration)       at System.Data.Entity.ModelConfiguration.Configuration.Types.StructuralTypeConfiguration.ConfigurePropertyMappings(IList 1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride) at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigurePropertyMappings(DbDatabaseMapping databaseMapping, EntityType entityType, DbProviderManifest providerManifest, Boolean allowOverride) at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.Configure(EntityType entityType, DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest) at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntityTypes(DbDatabaseMapping databaseMapping, ICollection 1 entitySets,DbProviderManifest providerManifest)at System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.Configure(DbDatabaseMapping databaseMapping,DbProviderManifest providerManifest)       在System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest,DbProviderInfo providerInfo)       在System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)       在System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)at System.Data.Entity.Internal.RetryLazy 2.GetValue(TInput input) at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized() at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer) at System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w) at System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action 1 writeXml)       在System.Data.Entity.Migrations的System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context)处于System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration配置,DbContext usersContext,DatabaseExistenceState existState,Boolean calledByCreateDatabase)处。 System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()中的.DbMigrator..ctor(DbMigrationsConfiguration配置)       在System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()       在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)       在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)       在System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)       System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration,Boolean force)at System.Data.Entity.Migrations.UpdateDatabaseCommand。&lt;&gt; c__DisplayClass2。&lt; .ctor&gt; b__0()at System.Data .Entity.Migrations.MigrationsDomainCommand.Execute(动作命令)       序列不包含匹配元素

我不确定这条消息是什么意思所以任何人都可以帮助我理解我做错了什么?!

0 个答案:

没有答案