“更新模型”向导不适用于NPGSQL和Visual Studio 2013 EntityFrameWork
-
21-12-2019 - |
题
目前我们使用Visual Studio 2012,EF 5.0和NPGSQL 2.0.12.0。
我想升级到Visual Studio 2013和NPGSQL 2.0.14.3(现在对EF 5.0很好)。
目前,我们使用“更新模型”向导,该向导在模式中占据了任何更改,并将它们送入到VS Designer中查看的EDMX文件。我们通过遵循NPGSQL.Provider2中使用DDEx的尴尬程序来执行此操作,并启动“实验”Visual Studio实例。
但这在Visual Studio 2013中不再有效(在更新生成的注册表项后)。如果我将DBProvider更改为NPGSQL 2.0.14.3,它也不工作。
如果有人能告诉我,如果他们在工作以及如何开始,那将是出色的。作为临时替代方案,我考虑通过使用edmgen.exe从架构更新EDMX文件。到目前为止,我一直能够生成.csdl,.ssdl和.mdl文件,但我找不到一种方法来将所有人打包到.edmx文件中。有人试过这种方法吗?
解决方案
EF Designer需要一个DDEX提供商能够工作。如上所述,DDEX提供商仅安装在VS2012的实验版本中。安装VS2013时,您没有DDEX提供程序的注册表项,EF Designer无法与您的数据库合作。
EDMX只是将CSDL MSL和SSDL一起粘合在一起。假设您使用V3模式(即,您的CSDL在此命名空间中:xmlns="http://schemas.microsoft.com/ado/2009/11/edm"
)您只能粘贴此模板中文件的内容(我添加了哪个文件应该被粘贴到哪里):
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<!-- paste SSDL contents here -->
</edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<!-- paste CSDL contents here -->
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<!-- paste MSL contents here -->
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<edmx:Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</edmx:Connection>
<edmx:Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="True" />
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
</DesignerInfoPropertySet>
</edmx:Options>
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
</edmx:Diagrams>
</edmx:Designer>
</edmx:Edmx>
. 不隶属于 StackOverflow