Code First哪里是元数据集合?

时间:2014-11-19 06:40:23

标签: c# entity-framework ef-code-first

我正在尝试启用迁移,并且我收到以下异常:

  

具有身份的项目' my_table'已经存在于元数据集合中。   参数名称:item

这是完整的堆栈跟踪:

  

System.ArgumentException:具有标识的项目&#39; my_table&#39;已经存在于元数据集合中。   参数名称:item      在System.Data.Entity.Core.Metadata.Edm.MetadataCollection 1.AddInternal(T item) at System.Data.Entity.Core.Metadata.Edm.EntitySetBaseCollection.Add(EntitySetBase item) at System.Data.Entity.ModelConfiguration.Edm.EdmModelExtensions.AddAssociationSet(EdmModel model, String name, AssociationType associationType) at System.Data.Entity.ModelConfiguration.Mappers.NavigationPropertyMapper.Map(PropertyInfo propertyInfo, EntityType entityType, Func 1 entityTypeConfiguration)      at System.Data.Entity.ModelConfiguration.Mappers.TypeMapper.MapEntityType(Type type)      在System.Data.Entity.ModelConfiguration.Mappers.NavigationPropertyMapper.Map(PropertyInfo propertyInfo,EntityType entityType,Func 1 entityTypeConfiguration) at System.Data.Entity.ModelConfiguration.Mappers.TypeMapper.MapEntityType(Type type) at System.Data.Entity.DbModelBuilder.<>c__DisplayClassd.<MapTypes>b__7(Type type) at System.Linq.Enumerable.WhereListIterator 1.MoveNext()      在System.Data.Entity.Utilities.IEnumerableExtensions.Each [T](IEnumerable 1 ts, Action 1个动作)      在System.Data.Entity.DbModelBuilder.MapTypes(EdmModel模型)      在System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest,DbProviderInfo providerInfo)      在System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)      在System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)      在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.Utilities.DbContextExtensions.GetModel(DbContext context)      在System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration配置,DbContext usersContext,DatabaseExistenceState existState,Boolean calledByCreateDatabase)      在System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration配置)      在System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration)      在System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()      在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)      在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)      在System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)      at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldInitialCreate(String language,String rootNamespace)      在System.Data.Entity.Migrations.EnableMigrationsCommand。&lt;&gt; c__DisplayClass2。&lt; .ctor&gt; b__0()      在System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(操作命令)

这是一个新的数据库,其中尚未应用任何迁移,并且没有找到__MigrationHistory表。

那么元数据集合在哪里?

0 个答案:

没有答案