|
Use EDMGEN To Generate Entity Framework Model
.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
Get Updates By Email
Popular Post
- LINQ To SQL Tutorial
- LINQ To SQL Join On Multiple Conditions
- Code Sample: Programmatically Download File Using C#
- Free Icons And Images With Visual Studio 2008
- Windows 7 Control Panel In Classic Mode
- Dynamic Sort With LINQ
- Use SqlConnection With LINQ To SQL
- StyleCop Tutorial
- Write To Vista Event Log Using C#
- More Details Emerge On Microsoft Master Certification
Tag Cloud
Code Snippets
- Get Current Windows User In C#
- Get Width And Height Of Image In C#
- Get Windows Registry Size With WMI And C#
- Reverse Array Elements Using C#
- Convert Hexadecimal To Number In C#
- Get Free Disk Space Using T-SQL
- SQL Server 2008 – Get All Indexes In A Database
- Get Name Of Current Executing Assembly In C#
- Get CD Or DVD Drive Information Using WMI And C#
- Get Last Row From Table Using LINQ To SQL

