【发布时间】:2016-02-24 14:31:10
【问题描述】:
背景优先:我在 Windows 10 Pro 笔记本电脑上的 Visual Studio 2015(最新的 nuget 6.1.3 指向本地 SQL Server 2014 SP1 Express 数据库)中有一个数据库优先的 EF6 模型。在我从 Windows 8.1 和 Visual Studio 2013 升级之后。我也在大约 6 个月前从 EF5 升级了模型,但我认为这无关紧要,因为我也尝试过从头开始重建。
模型:包含大约 100 个表、50 个视图和 250 个关联。
问题是每次我想更改我的模型时,.edmx 图表上的任何类型的单击(左或右)都会导致 Visual Studio 在几分钟内变得无响应。我已经把我能做的一切都移到了另一个没有这个问题的图表上(大多数是没有关联的视图),所以我假设关联的数量是问题所在。其中大部分是从数据库中提取的所需外键关联。然而,连接 3 个 FK 关联以查看我的主图需要大约半小时。我可以理解模型中的实体是否存在限制,但我不明白为什么只需单击图表就会使 Visual Studio 变得无响应。任务管理器显示 CPU 使用率很高,并且没有磁盘使用。
单击任何实体都可以,移动它们或编辑它们也是如此。问题在于点击背景画布。
我已经开始通过模型浏览器从数据库中更新模型,但我无法通过右键单击图表来创建新关联。
我在任何地方都没有看到任何关于这个问题的 cmets。任何原因或解决方法的建议?
顺便说一句,我刚刚重新安装了 Windows 10 Pro,只安装了 SQL Server 2014 SP1 Express 和 Visual Studio 2105 Pro。所以我的系统上没有任何自定义。
更新:当 DevEnv.exe 变得无响应时,ProcDump 会提供此堆栈跟踪,建议使用本机代码搜索图形对象:
[External Code]
[Managed to Native Transition]
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!<Module>.GeoSCursor.search(GeoSCursor* value)
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGGraph.GetObjectsInRect(LRECT bbox, Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGLayoutObjectList items, VSGLayoutObject** ignoreItems, int numberItems, int numbertypes, int* types, bool searchSubGraphs)
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGGraph.GetObjectsInRect(LRECT bbox, Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGLayoutObjectList items, VSGLayoutObject** ignoreItems, int numberItems, int numbertypes, int* types, bool searchSubGraphs)
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphObject.VGGraph.get_ObjectsInRectangle(double x0, double y0, double x1, double y1, bool searchSubGraphs)
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphWrapper.HitTest(Microsoft.VisualStudio.Modeling.Diagrams.RectangleD hitArea, bool requireCompleteContainment, bool searchSubGraphs)
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.GraphWrapper.SpatialQuery(Microsoft.VisualStudio.Modeling.Diagrams.GraphWrapper.SpatialDirection direction, Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement currentShape, Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement parentShape)
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement.FindNextInChildShapes(Microsoft.VisualStudio.Modeling.Diagrams.ShapeElement startFromChildShape, bool focusableRequired)
Microsoft.VisualStudio.Modeling.Sdk.Diagrams.14.0.dll!Microsoft.VisualStudio.Modeling.Diagrams.ShapeAccessibleObject.GetChild(int index)
System.Windows.Forms.dll!System.Windows.Forms.AccessibleObject.GetFocused()
System.Windows.Forms.dll!System.Windows.Forms.AccessibleObject.Accessibility.IAccessible.accFocus.get()
System.Windows.Forms.dll!System.Windows.Forms.InternalAccessibleObject.System.Windows.Forms.UnsafeNativeMethods.IAccessibleInternal.get_accFocus()
UPDATE2:XtraSimplicity 有一个适用于某些人的解决方案,但不适用于我。感谢他的建议,我已将其排除为直接图形驱动程序问题。我的笔记本电脑中有英特尔高清显卡系列和 NVIdia GeForce GT 750M 显示适配器。英特尔是常用的主动适配器,但仅启用 NVidia 时也会出现问题。我也尝试过在 Visual Studio 中禁用硬件支持的建议,但如果有任何东西只会在打开 edmx 时使 VS 的性能更差。
【问题讨论】:
-
EF7 将删除 edmx,因此您现在可以尝试使用代码优先解决方案。
-
当只有部分数据库通过 EF 以及许多与缓存和数据相关的内部触发器、视图、函数和存储过程使用时,使用代码优先从来都不是维护数据库模型的真正选择建筑相当复杂。在这种情况下,数据库项目和使用 EF 数据库优先的效率更高。不过不使用 edmx 完全高兴,因此我们明年将研究 EF7 进行重建。
-
今天在 EF6 中使用“EF Reverse POCO”模板!
标签: entity-framework visual-studio-2015 entity-framework-6 edmx