C# 从6.1.0更新到实体框架6.1.1后出现异常

C# 从6.1.0更新到实体框架6.1.1后出现异常,c#,entity-framework,C#,Entity Framework,我首先使用代码,并且有一个类的结构。我有一个描述所有实体的EntityDO类MetadataEntityDO-元数据描述类。还有许多从MetadataEntityDO继承的类(例如AreaTemplateDO) DbContext中的映射配置: protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder);

我首先使用代码,并且有一个类的结构。我有一个描述所有实体的
EntityDO
MetadataEntityDO
-元数据描述类。还有许多从
MetadataEntityDO
继承的类(例如
AreaTemplateDO

DbContext
中的映射配置:

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        modelBuilder.Entity<MetadataEntityDO>().Map(m =>
        {
            m.MapInheritedProperties();
            m.ToTable("MetadataEntity");
        });

        modelBuilder.Entity<AreaTemplateDO>().Map(m => m.ToTable("AreaTemplate"));
    } 
在EF 6.1.0中,它工作正常,但在更新到6.1.1后,我得到了以下异常:

System.Data.Entity.Infrastructure.DbUpdateException:从ObjectStateEntry检索值时出错。有关详细信息,请参阅内部异常。
---->System.Data.Entity.Core.UpdateException:从ObjectStateEntry检索值时出错。有关详细信息,请参阅内部异常。
---->System.Data.Entity.Core.MappingException:
(265,10):错误3032:映射从第265,399行开始的片段时出现问题:EntityTypes PAG.PAGiT.Data.AreaTemplateDO,PAG.PAGiT.Data.TemplateadditionlaAttributeDO,PAG.PAGiT.Data.BasicUnitDO,PAG.PAGiT.Data.TemplateConstraintDO,PAG.PAGiT.Data.TemplateScriptDO,PAG.PAGiT.Data.CatalogTemplateDO,PAG.PAGiT.Data.ConstantTemplateDO,PAG.PAGiT.Data.MaterialTemplateDO,PAG.PAGiT.Data.BasicCopeOptionInOutTemplateDO,PAG.PAGiT.Data.BasicCopeOptionTemplateDO,PAG.PAGiT.Data.OperationTemplateDO,PAG.PAGiT.Data.PlantTemplateDO,PAG.PAGiT.Data.ProcessUnitTemplateDO,PAG.PAGiT.Data.RecipeElementDO,PAG.PAGiT.Data.RecipeElementDO,PAG.PAG.PAGiT.Data.RecipeProcedureDO,PAG.PAGiT.Data.RecipeProcedureFormulaDO、PAG.PAGiT.Data.StringListDO、PAG.PAGiT.Data.UserTemplateDO、PAG.PAGiT.Data.WorkOrderTemplateDO正在映射到表MetadataEntityDO中的相同行。映射条件可用于区分这些类型映射到的行

结果堆栈跟踪:
位于System.Data.Entity.Internal.InternalContext.SaveChanges()
位于System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
在System.Data.Entity.DbContext.SaveChanges()中 在PAG.PAGiT.Data.PAGiTMetadataContext.SaveChanges()处,c:\WorkGitRep\PAG.PAGiT\PAG.PAGiT.Data\PAGiTMetadataContext.cs:Сааа84
在PAG.PAGiT.Data.IntegrationTest.PAGiTMetadataContextTest.PAGiTMetadataContext_AddEntity_ChangeUpdateDateTime()
在c:\WorkGitRep\PAG.PAGiT\PAG.PAGiT.Data.IntegrationTest\PAGiTMetadataContextTest.cs:Саааа52

更新异常

System.Data.Entity.Core.Mapping.Update.Internal.RecordConverter.ConvertStateEntryTopPropagatorResult(IEntityStateEntry stateEntry、Boolean useCurrentValues、ModifiedProperties行为ModifiedProperties行为)
位于System.Data.Entity.Core.Mapping.Update.Internal.ExtractedStateEntry..ctor(UpdateTranslator translator translator,IEntityStateEntry stateEntry stateEntry)
位于System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.LoadStateEntry(IEntityStateEntry stateEntry)
位于System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.PullModifiedEntriesFromStateManager()
位于System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
在System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()中 位于System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.b_uu2(UpdateTranslator ut)
在System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult,Func
2 updateFunction)中
位于System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update() 位于System.Data.Entity.Core.Objects.ObjectContext.b_u35()
在System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func
1 Func,IDbExecutionStrategy executionStrategy,Boolean startLocalTransaction,Boolean releaseConnectionOnSuccess)
位于System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(保存选项选项、IDBEcutionStrategy执行策略、布尔startLocalTransaction)
在System.Data.Entity.Core.Objects.ObjectContext.c__DisplayClass2a.b__27()
在System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func
1操作)
of System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(保存选项选项,布尔执行现有事务) of System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(保存选项) of System.Data.Entity.Internal.InternalContext.SaveChanges() --映射异常 of System.Data.Entity.Core.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedGenerateView(EntityContainerMappingEntityContainerMap,Dictionary
2 resultDictionary) of System.Data.Entity.Core.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedGetGeneratedView(EntityContainer容器) of System.Data.Entity.Core.Common.Utils.Memoizer
2.c_uudisplayClass2.b_u0()
of System.Data.Entity.Core.Common.Utils.Memoizer
2.Result.GetValue() of System.Data.Entity.Core.Common.Utils.Memorizer
2.Evaluate(目标参数)
of System.Data.Entity.Core.Mapping.StorageMappingItemCollection.ViewDictionary.GetGeneratedView(EntitySetBase区段、MetadataWorkspace工作区、StorageMappingItemCollection StorageMappingItemCollection)
of System.Data.Entity.Core.Mapping.Update.Internal.ViewLoader.InitializeEntitySet(EntitySetBase EntitySetBase,MetadataWorkspace工作区)
of System.Data.Entity.Core.Mapping.Update.Internal.ViewLoader.SyncInitializeEntitySet[TArg,TResult](EntitySetBase EntitySetBase,MetadataWorkspace工作区,Func
2评估,TArg参数) of System.Data.Entity.Core.Mapping.Update.Internal.ExtractorMetadata..ctor(EntitySetBase EntitySetBase,StructuralType,UpdateTranslator-translator-translator) of System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.GetExtractorMetadata(EntitySetBase EntitySetBase,StructuralType) of System.Data.Entity.Core.Mapping.Update.Internal.ExtractorMetadata.ExtractResultFromRecord(IEntityStateEntry stateEntry,Boolean isModified,IExtendedData
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        modelBuilder.Entity<MetadataEntityDO>().Map(m =>
        {
            m.MapInheritedProperties();
            m.ToTable("MetadataEntity");
        });

        modelBuilder.Entity<AreaTemplateDO>().Map(m => m.ToTable("AreaTemplate"));
    } 
    [Test]
    public void PAGiTMetadataContext_AddEntity_ChangeUpdateDateTime()
    {
        Guid guid = Guid.NewGuid();

        using (var dc = new PAGiTMetadataContext(testTimemanager, "TestEntityDatabase"))
        {
            dc.AreaTemplates.Add(new AreaTemplateDO() { ID = guid, Name = "Name", VersionCount = 1 });
            dc.SaveChanges();
            areaTemplate = dc.AreaTemplates.First(p => p.ID == guid);
        }
    }