实体框架花费大量时间初始化模型

2024-03-21

我面临 EF 花费大量时间(跨越数小时)来初始化模型的问题。该模型如下所示。大约有 20 个类从 A1 派生,大约 30 个类从 A2 派生。

我必须从 TPT 战略转向 TPH 战略解决问题 https://stackoverflow.com/questions/14171506/out-of-memory-exception-while-retrieving-a-lazy-loaded-list-in-entity-framewor与内存使用有关。从那时起我就试图解决这个问题。

该问题是通过创建类型“A”的单个实例并将其添加到List<A>另一个实体的财产并提交这些更改。此时已经过去了大约2.5个小时,还没有提交更改!

深入代码(等待大约一个小时完成),调用堆栈是:

System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.IfThenElse(System.Data.Common.Utils.Boolean.Vertex condition, System.Data.Common.Utils.Boolean.Vertex then, System.Data.Common.Utils.Boolean.Vertex else) + 0x14e bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.And.AnonymousMethod__1(System.Data.Common.Utils.Boolean.Vertex left, System.Data.Common.Utils.Boolean.Vertex right) + 0x29 bytes 
System.Core.dll!System.Linq.Enumerable.Aggregate<System.Data.Common.Utils.Boolean.Vertex,System.Data.Common.Utils.Boolean.Vertex>(System.Collections.Generic.IEnumerable<System.Data.Common.Utils.Boolean.Vertex> source, System.Data.Common.Utils.Boolean.Vertex seed, System.Func<System.Data.Common.Utils.Boolean.Vertex,System.Data.Common.Utils.Boolean.Vertex,System.Data.Common.Utils.Boolean.Vertex> func) + 0x99 bytes 
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Solver.And(System.Collections.Generic.IEnumerable<System.Data.Common.Utils.Boolean.Vertex> children) + 0x90 bytes   
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.ToDecisionDiagramConverter<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>>.VisitAnd(System.Data.Common.Utils.Boolean.AndExpr<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>> expression) + 0x77 bytes 
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.AndExpr<System.__Canon>.Accept<System.__Canon>(System.Data.Common.Utils.Boolean.Visitor<System.__Canon,System.__Canon> visitor) + 0xc bytes 
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.ToDecisionDiagramConverter<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>>.TranslateToRobdd(System.Data.Common.Utils.Boolean.BoolExpr<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>> expr, System.Data.Common.Utils.Boolean.ConversionContext<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>> context) + 0x72 bytes 
System.Data.Entity.dll!System.Data.Common.Utils.Boolean.Converter<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>>.Converter(System.Data.Common.Utils.Boolean.BoolExpr<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>> expr, System.Data.Common.Utils.Boolean.ConversionContext<System.Data.Common.Utils.Boolean.DomainConstraint<System.Data.Mapping.ViewGeneration.Structures.BoolLiteral,System.Data.Mapping.ViewGeneration.Structures.Constant>> context) + 0x46 bytes 
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.QueryRewriting.FragmentQueryProcessor.IsSatisfiable(System.Data.Mapping.ViewGeneration.Structures.BoolExpression condition) + 0xac bytes  
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.QueryRewriting.FragmentQueryProcessor.IsSatisfiable(System.Data.Mapping.ViewGeneration.QueryRewriting.FragmentQuery query) + 0x8 bytes    
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.Structures.CellTreeNode.IsEmptyRightFragmentQuery.get() + 0x1e bytes  
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.BasicViewGenerator.IsDisjoint(System.Data.Mapping.ViewGeneration.Structures.CellTreeNode n1, System.Data.Mapping.ViewGeneration.Structures.CellTreeNode n2) + 0xbb bytes  
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.BasicViewGenerator.TryAddChildToGroup(System.Data.Mapping.ViewGeneration.Structures.CellTreeOpType opTypeToIsolate, System.Data.Mapping.ViewGeneration.Structures.CellTreeNode childNode, System.Data.Mapping.ViewGeneration.Structures.OpCellTreeNode groupNode) + 0x3f bytes    
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.BasicViewGenerator.IsolateByOperator(System.Data.Mapping.ViewGeneration.Structures.CellTreeNode rootNode, System.Data.Mapping.ViewGeneration.Structures.CellTreeOpType opTypeToIsolate) + 0x1eb bytes 
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.BasicViewGenerator.CreateViewExpression() + 0xeb bytes    
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.QueryRewriting.QueryRewriter.GenerateViewComponents() + 0x12a bytes   
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.ViewGenerator.GenerateViewsForExtentAndType(System.Data.Metadata.Edm.EdmType generatedType, System.Data.Mapping.ViewGeneration.ViewgenContext context, System.Data.Mapping.ViewGeneration.Structures.CqlIdentifiers identifiers, System.Data.Common.Utils.KeyToListMap<System.Data.Metadata.Edm.EntitySetBase,System.Data.Mapping.ViewGeneration.GeneratedView> views, System.Data.Mapping.ViewGeneration.ViewGenMode mode) + 0x2f bytes  
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.ViewGenerator.GenerateDirectionalViewsForExtent(System.Data.Mapping.ViewGeneration.Structures.ViewTarget viewTarget, System.Data.Metadata.Edm.EntitySetBase extent, System.Data.Mapping.ViewGeneration.Structures.CqlIdentifiers identifiers, System.Data.Common.Utils.KeyToListMap<System.Data.Metadata.Edm.EntitySetBase,System.Data.Mapping.ViewGeneration.GeneratedView> views) + 0x58 bytes  
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.ViewGenerator.GenerateDirectionalViews(System.Data.Mapping.ViewGeneration.Structures.ViewTarget viewTarget, System.Data.Mapping.ViewGeneration.Structures.CqlIdentifiers identifiers, System.Data.Common.Utils.KeyToListMap<System.Data.Metadata.Edm.EntitySetBase,System.Data.Mapping.ViewGeneration.GeneratedView> views) + 0xce bytes  
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.ViewGenerator.GenerateAllBidirectionalViews(System.Data.Common.Utils.KeyToListMap<System.Data.Metadata.Edm.EntitySetBase,System.Data.Mapping.ViewGeneration.GeneratedView> views, System.Data.Mapping.ViewGeneration.Structures.CqlIdentifiers identifiers) + 0xd7 bytes  
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.ViewgenGatekeeper.GenerateViewsFromCells(System.Collections.Generic.List<System.Data.Mapping.ViewGeneration.Structures.Cell> cells, System.Data.Mapping.ViewGeneration.ConfigViewGenerator config, System.Data.Mapping.ViewGeneration.Structures.CqlIdentifiers identifiers, System.Data.Mapping.StorageEntityContainerMapping containerMapping) + 0x1aa bytes    
System.Data.Entity.dll!System.Data.Mapping.ViewGeneration.ViewgenGatekeeper.GenerateViewsFromMapping(System.Data.Mapping.StorageEntityContainerMapping containerMapping, System.Data.Mapping.ViewGeneration.ConfigViewGenerator config) + 0xbf bytes    
System.Data.Entity.dll!System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedGenerateViews(System.Data.Mapping.StorageEntityContainerMapping entityContainerMap, System.Collections.Generic.Dictionary<System.Data.Metadata.Edm.EntitySetBase,System.Data.Mapping.ViewGeneration.GeneratedView> resultDictionary) + 0x3a bytes  
System.Data.Entity.dll!System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.SerializedGetGeneratedViews(System.Data.Metadata.Edm.EntityContainer container) + 0xd2 bytes 
System.Data.Entity.dll!System.Data.Common.Utils.Memoizer<System.__Canon,System.__Canon>.Evaluate.AnonymousMethod__0() + 0x13 bytes  
System.Data.Entity.dll!System.Data.Common.Utils.Memoizer<System.Data.Metadata.Edm.EntityContainer,System.Collections.Generic.Dictionary<System.Data.Metadata.Edm.EntitySetBase,System.Data.Mapping.ViewGeneration.GeneratedView>>.Result.GetValue() + 0x69 bytes    
System.Data.Entity.dll!System.Data.Common.Utils.Memoizer<System.Data.Metadata.Edm.EntityContainer,System.Collections.Generic.Dictionary<System.Data.Metadata.Edm.EntitySetBase,System.Data.Mapping.ViewGeneration.GeneratedView>>.Evaluate(System.Data.Metadata.Edm.EntityContainer arg) + 0x6e bytes   
System.Data.Entity.dll!System.Data.Mapping.StorageMappingItemCollection.ViewDictionary.GetGeneratedView(System.Data.Metadata.Edm.EntitySetBase extent, System.Data.Metadata.Edm.MetadataWorkspace workspace, System.Data.Mapping.StorageMappingItemCollection storageMappingItemCollection) + 0x49 bytes    
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.ViewLoader.InitializeEntitySet(System.Data.Metadata.Edm.EntitySetBase entitySetBase, System.Data.Metadata.Edm.MetadataWorkspace workspace) + 0x74 bytes  
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.ViewLoader.SyncInitializeEntitySet<System.__Canon,System.__Canon>(System.Data.Metadata.Edm.EntitySetBase entitySetBase, System.Data.Metadata.Edm.MetadataWorkspace workspace, System.Func<System.__Canon,System.__Canon> evaluate, System.__Canon arg) + 0xdf bytes  
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.ViewLoader.SyncGetValue<System.Data.Metadata.Edm.AssociationSet,System.Data.Mapping.Update.Internal.AssociationSetMetadata>(System.Data.Metadata.Edm.EntitySetBase entitySetBase, System.Data.Metadata.Edm.MetadataWorkspace workspace, System.Collections.Generic.Dictionary<System.Data.Metadata.Edm.AssociationSet,System.Data.Mapping.Update.Internal.AssociationSetMetadata> dictionary, System.Data.Metadata.Edm.AssociationSet key) + 0x9c bytes  
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.UpdateTranslator.ValidateAndRegisterStateEntry(System.Data.IEntityStateEntry stateEntry) + 0x109 bytes   
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.UpdateTranslator.LoadStateEntry(System.Data.IEntityStateEntry stateEntry) + 0x23 bytes   
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.UpdateTranslator.PullModifiedEntriesFromStateManager() + 0x156 bytes 
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.UpdateTranslator.ProduceCommands() + 0x1a bytes  
System.Data.Entity.dll!System.Data.Mapping.Update.Internal.UpdateTranslator.Update(System.Data.IEntityStateManager stateManager, System.Data.IEntityAdapter adapter) + 0xc9 bytes   
System.Data.Entity.dll!System.Data.EntityClient.EntityAdapter.Update(System.Data.IEntityStateManager entityCache) + 0x93 bytes  
System.Data.Entity.dll!System.Data.Objects.ObjectContext.SaveChanges(System.Data.Objects.SaveOptions options) + 0x23c bytes 
EntityFramework.dll!System.Data.Entity.Internal.InternalContext.SaveChanges() + 0x144 bytes 
EntityFramework.dll!System.Data.Entity.Internal.LazyInternalContext.SaveChanges() + 0x36 bytes  
EntityFramework.dll!System.Data.Entity.DbContext.SaveChanges() + 0x35 bytes

从您显示的堆栈跟踪来看,在我看来问题出在视图生成中。由于您首先使用代码,我鼓励您尝试EF6 http://entityframework.codeplex.com其中包含视图生成的性能改进。对于以前的版本,作为解决方法,您可以预先生成视图(例如,使用 EF Power Tools 或我创建的模板http://visualstudiogallery.msdn.microsoft.com/ae7730ce-ddab-470f-8456-1b313cd2c44d http://visualstudiogallery.msdn.microsoft.com/ae7730ce-ddab-470f-8456-1b313cd2c44d)。创建视图仍然需要很长时间,但这将是在设计时而不是运行时。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

实体框架花费大量时间初始化模型 的相关文章

随机推荐

  • 依赖于失败的 Gradle 任务

    一个 Gradle 任务可以依赖于另一个任务的失败吗 例如 我有一个辅助任务 在浏览器中打开测试报告 我希望报告仅在任务 测试 失败时出现 而不是像现在一样在所有测试都通过时出现 task viewTestReport dependsOn
  • ShadowProperties 在创建之前由 foreach 访问

    我是实体框架新手 正在通过 Julie Lerman 的 Pluralsight 课程学习 ATM 我正在看第二课 实体框架核心 2 映射 https app pluralsight com library courses e f core
  • Python:解析 XML 文档同时保留实体

    我想问有哪些已知的现有 Python 2 x 库可用于使用内置 DTD 解析 XML 文档without自动扩展实体 对于那些好奇的人来说有问题的文件 JMdict ftp ftp monash edu au pub nihongo JMd
  • 将画布对象保存为 json

    我将如何序列化画布对象 如下所示 context beginPath context rect 188 50 200 100 context fillStyle yellow context fill context lineWidth 7
  • ConditionalAttribute 和其他特殊类

    The ConditionalAttribute可用于根据定义的编译器符号删除对标记方法的调用 我假设我们无法自己创建此类 因为编译器必须专门寻找它 我想知道编译器或语言使用的其他类是我们无法自己编写的 除了提到的那些之外 Attribut
  • puppeteer 通过启用 cookie 和 Javascript 绕过 cloudflare

    仅在 NodeJs gt 服务器端 我正在做一些网页抓取 一些页面受到 cloudflare anti ddos 页面的保护 我正在尝试绕过此页面 通过搜索 我发现了很多关于隐身方法或 reCapcha 的文章 但问题是 cloudflar
  • 如何从根 Angular 对象获取 $rootElement

    我的目标是找到任意 Angular 项目中的根元素 如果我所拥有的只是angular目的 这显然不太合规 所以一个破解的解决方案就可以了 我的第一个方法是find ng app 但这在引导应用程序上失败 我一直在尝试各种角度模块 但陷入了僵
  • MongoDB 如何查找哪个多边形包含指定点?

    我将许多多边形插入MongoDB 2 4 8 并希望找到指定点所在的多边形 这似乎是一个常见问题 但在阅读了谷歌的所有文档后 我没有得到结果 所以提出这个问题 e g db addr poly insert loc type Polygon
  • 我们可以在 标签内添加

    当我在锚标记内编写 html 代码时 我的 Dreamweaver 编辑器在锚标记中显示错误 不应该使用内部标签吗 编写 使用标签有什么规则吗 我正在使用 Html 5 这是我的代码 http jsfiddle net CfPnj http
  • 如何根据Json反序列化JArray数据创建DataTable?

    我有以下 JArray 数据 我需要根据 Jarray 中的列名动态创建一个数据表 然后我需要插入数据 你能帮我做这个手术吗 pre PID 3 FirstName parveen LastName a Gender male PID 8
  • 尝试升级到 1.22 时 MediaWiki DB 连接错误

    我在共享主机服务器上安装了 MediaWiki 它的版本是 1 19 1 我正在尝试更新到 1 22 2 文档表明一步更新应该可以解决此问题 我已经在过去的更新中成功完成了几次此操作 并且正在遵循以前的注释 我建立了一个新目录 其中包含1
  • 将 .keystore 转换为 .jks 以签署 apk

    我有一个 Android 应用程序 我试图使用 quixxi com 来保护它 但它要求我再次签署该应用程序 但要做到这一点 它必须使用 jks 文件 但我的密钥库是 keystore 我在 C 中使用 Xamarin Android 和
  • 想要隐藏 Jackson 映射到 JSON 的对象的某些字段

    我有一个 User 类 我想使用 Jackson 将其映射到 JSON public class User private String name private int age private int securityCode gette
  • 如何阻止链接在 Gmail 的集成迷你浏览器中打开

    在 Android 上 当用户使用 Gmail 打开邮件并单击邮件中包含的链接时 该 URL 会在某种 迷你浏览器 中打开 顶部有一个特殊的栏 就我而言 URL 是可移植 Web 应用程序 PWA 应在 Chrome 浏览器本身中打开 使用
  • CardLayout 中的可滚动 JPanel?

    我一直在寻找一种方法来添加垂直滚动条JPanel依次添加到CardLayout控制板 我查找了这里所有与实现可滚动相关的帖子JPanel但我不知道如何用这个特定的方法来实现它CardLayout Oracle 也没有给出我可以使用的示例 也
  • sparql 主题的完整树

    例如 当我有一个人图时 例如约翰和约翰有工作地址 家庭地址 电话号码 关系等 是否有可能在不知道它是什么的情况下检索与 john 及其子类相关的所有内容 这样我就可以检索例如以下内容 John lt address lt house num
  • 为什么 ++x 是左值而 x++ 是右值? [复制]

    这个问题在这里已经有答案了 所以我一直在阅读左值和右值 我对两者之间的区别有点困惑 x and x 当谈到这个分类时 Why is x左值和x 右值 x返回对您增加的对象的引用 其中x 返回一个临时副本x的旧值 至少这将是按照惯例实现这些运
  • Android WebView Java-Javascript 桥接器

    我想知道是否可以从Java代码中获取Javascript变量值 换句话说 我在 WebView 中有 JS 代码 并且我需要能够从 WebView 的 JS 代码获取变量 是的 可以通过安装 Java JS 桥 然后将 JS 注入到收集数据
  • 非常纠结 cocoapods / ruby​​ 设置

    这工作正常 然后突然就不行了 我希望我知道为什么 真的卡住了 在网上找不到任何东西 我正在开发一个 ObjectiveC 项目 我尝试用以下方法重置一切 sudo gem uninstall ruby sudo gem uninstall
  • 实体框架花费大量时间初始化模型

    我面临 EF 花费大量时间 跨越数小时 来初始化模型的问题 该模型如下所示 大约有 20 个类从 A1 派生 大约 30 个类从 A2 派生 我必须从 TPT 战略转向 TPH 战略解决问题 https stackoverflow com