How to generate .edmx.diagram file using edmgen.exe?

asp.net-mvc c# edmx-designer entity-framework-6 visual-studio-2015

Accepted Answer

Short Response

in order toedmx You may choose one of the following methods to have the designer display the diagrams:

  • Having <Designers></Designers> tag inedmx file.

  • Having .edmx.designer the following file's contents, which is a child of.edmx file:

    <?xml version="1.0" encoding="utf-8"?>
    <edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
      <edmx:Designer>
        <edmx:Diagrams>
    
        </edmx:Diagrams>
      </edmx:Designer>
    </edmx:Edmx>
    

Long Response

Zzz-49-Zzz won't produceedmx for you, yet it creates every piece of information required to produce anedmx file on your own. You may easily combine them to make an edmx file.csdl , ssdl and msl .

you should be aware of the schematic file as well.edmx.diagram file is not required. Whenever you design theedmx with an empty file<Diagrams></Diagrams> tag, Visual Studio will generate the content for the tag for you when you open the edmx file in designer for the first time. Then if for any reason you like to have ot in separate file, you can simply right click on design surface of the edmx and chooseMove Diagrams to Separate File .

The instructions below may be used to make anedmx you manually (or via code) file:

Run, zzz-93, zzzEdmGen

"%windir%\Microsoft.NET\Framework\v4.0.30319\edmgen.exe" /mode:fullgeneration  /c:"Data Source=SERVERNAME; Initial Catalog=DATABASENAME;Integrated Security=SSPI" /project:PROJECT /entitycontainer:CONTAINER /namespace:NAMESPACE /language:CSharp /targetversion:4.5

Create an edmx file with the following information in it.

Remember that theedmx The information I used to create this article is based on/targetversion:4.5 switch.

<?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>
    $SSDL$
    </edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
    $CSDL$
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
    $MSL$
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
    <Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </Connection>
    <Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
        <DesignerProperty Name="EnablePluralization" Value="true" />
        <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
        <DesignerProperty Name="UseLegacyProvider" Value="false" />
        <DesignerProperty Name="CodeGenerationStrategy" Value="None" />
      </DesignerInfoPropertySet>
    </Options>
    <!-- Diagram content (shape and connector positions) -->
    <Diagrams></Diagrams>
  </Designer>
</edmx:Edmx>

3- The following files' content should be substituted for the placeholders in your edmx file (without<?xml version="1.0" encoding="utf-8"?> ):

  • $SSDL$ should be changed to reflect the content of thessdl file.
  • $CSDL$ should be changed to reflect the content of thecsdl file.
  • $MSL$ should be changed to reflect the content of themsl file.

Note

.edmx.designer is optional, and having an is sufficient.<Diagrams></Diagrams> tag inedmx The diagram will be automatically constructed for you the first time you launch Visual Studio, similar to what I showed above. Additionally, if you want to have the diagram in a different file for whatever reason, you can easily create an empty diagram file, which VS will populate when you open edmx for the first time:

<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
  <edmx:Designer>
    <edmx:Diagrams>

    </edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>
2
1/25/2018 3:42:29 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow