Home / Programming / Blog article: Use EDMGEN To Generate Entity Framework Model

| RSS

Use EDMGEN To Generate Entity Framework Model

September 1st, 2008 | No Comments | Posted in Programming

.NET Framework 3.5 SP1 ships with a tool called edmgen. This tool can be used to generate the EDM (Entity Data Model). Being a command line tool it can be executed from a batch file or a Powershell script.

Edmgen can be used to generate either a full model or selected artifacts such as CSDL, MSI, source code etc. In order to generate a full model which includes CSDL, SSDL, MSL, C#/VB.NET code you can use

/mode:FullGeneration

edmgen also allows you to generate code in either C# or VB.NET using the /language option. To generate code in VB.NET you will use pass the language name to /language option

/language:VB

Lets say that you only have the SSDL which basically defines what your source database is. In such a scenario you can use FromSSDLGeneration mode

/mode:FromSSDLGeneration

If you just want to validate your CSDL, SSDL and MSL files before actually generating any code then you can use ValidateArtifacts mode.

/mode:ValidateArtifacts

This command generates a full model for AdventureWorks database from a local machine.

EdmGen /mode:FullGeneration /project:Northwind /provider:System.Data.SqlClient

/connectionstring:”server=.;integrated security=true;database=AdventureWorks”

edmgen is a great tool when working with Entity Framework. It also works well if you have a large number of database objects and do not want to stress Visual Studio designer.

Leave a Reply 3303 views, 1 so far today |

Leave a Reply





Switch to our mobile site