<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://code.msdn.microsoft.com/rss.xsl"?><rss version="2.0"><channel><title>Sample EDMX Code Generator</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Project/ProjectRss.aspx</link><description>The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some s...</description><item><title>NEW POST: Final generator source available?</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Thread/View.aspx?ThreadId=426</link><description>&lt;div class="wikidoc"&gt;
I would like to extend the functionality of the EDMX code generator once the final version has shipped by adding some custom CSDL annotations and modifying the generated code appropriately.  Will the source code for the standard generator be available so that I can piggy back on it's code generation.  I suppose the alternative is to write an entire EDMX generator from scratch??&lt;br /&gt;
&lt;/div&gt;</description><author>KevinR</author><pubDate>Mon, 02 Jun 2008 22:48:20 GMT</pubDate><guid isPermaLink="false">NEW POST: Final generator source available? 20080602P</guid></item><item><title>NEW POST: Final generator source available?</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Thread/View.aspx?ThreadId=425</link><description>&lt;div class="wikidoc"&gt;
I would like to extend the functionality of the EDMX code generator once the final version has shipped by adding some custom CSDL annotations and modifying the generated code appropriately.  Will the source code for the standard generator be available so that I can piggy back on it's code generation.  I suppose the alternative is to write an entire EDMX generator from scratch??&lt;br /&gt;
&lt;/div&gt;</description><author>KevinR</author><pubDate>Mon, 02 Jun 2008 22:48:19 GMT</pubDate><guid isPermaLink="false">NEW POST: Final generator source available? 20080602P</guid></item><item><title>NEW POST: How to get extended property from sql ?</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Thread/View.aspx?ThreadId=108</link><description>&lt;div class="wikidoc"&gt;
Hi&lt;br /&gt; &lt;br /&gt;i have a look to this code and it help me to understand.&lt;br /&gt;I want to add CustomAttributes to the classes &amp;amp; properties of the generated code. (I can do that with this code)&lt;br /&gt;But my problem is that the descriptions of the customattribut are in the extended properties of Tables and columns of my sql databases.&lt;br /&gt;So i would get the dataconnection use to retreive the database description for execute some sql commands to get the extended properties and and my CustomAttributes. &lt;br /&gt; &lt;br /&gt;How can i do ?&lt;br /&gt; &lt;br /&gt;Tx&lt;br /&gt;Thierry&lt;br /&gt;
&lt;/div&gt;</description><author>Thierry</author><pubDate>Sat, 01 Mar 2008 16:33:39 GMT</pubDate><guid isPermaLink="false">NEW POST: How to get extended property from sql ? 20080301P</guid></item><item><title>NEW POST: Use it to generate Enum properties</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Thread/View.aspx?ThreadId=75</link><description>&lt;div class="wikidoc"&gt;
I use your code to generate directly in .designer.cs properties of type Enum which encapsulate the csdl properties. All is here: http://blogs.codes-sources.com/matthieu/archive/2008/02/19/matthieu-fait-mumuse-avec-le-g-n-rateur-de-classe-d-edm.aspx&lt;br /&gt;
&lt;/div&gt;</description><author>MatthieuMEZIL</author><pubDate>Tue, 19 Feb 2008 15:55:58 GMT</pubDate><guid isPermaLink="false">NEW POST: Use it to generate Enum properties 20080219P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=13</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;&lt;a href="https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sampleedmxcodegen&amp;amp;ReleaseId=46" class="externalLink"&gt;Download &lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt;   gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;   &lt;/span&gt;&lt;/li&gt;&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;span class="codeInline"&gt; reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt; &lt;/span&gt; &lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt; gacutil /u SampleEdmxCodeGenerator &lt;/span&gt; &lt;/li&gt;&lt;li&gt;Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008: &lt;/li&gt;
&lt;/ol&gt;&lt;span class="codeInline"&gt; reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00} &lt;/span&gt;&lt;br /&gt;&lt;span class="codeInline"&gt; reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC} \SampleEdmxCodeGenerator &lt;/span&gt;&lt;br /&gt;&lt;span class="codeInline"&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Test
&lt;/h4&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Process an EDMX file with SampleEdmxCodeGenerator
&lt;/h4&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt; &lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt; &lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Add and edit CSDL annotations
&lt;/h4&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;/li&gt;&lt;li&gt;Click on “XML Editor” in the “Open With” dialog box&lt;/li&gt;&lt;li&gt;Click OK&lt;/li&gt;&lt;li&gt;The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;/li&gt;&lt;li&gt;If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;/li&gt;
&lt;/ol&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt; &lt;br /&gt;&lt;i&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'&lt;/i&gt;&lt;br /&gt; &lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt; &lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Open an EDMX file with CSDL annotations in the designer
&lt;/h4&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt; &lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt; &lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 19:04:58 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>CREATED RELEASE: Sample EDMX Code Generator V1.0 (Jan 24, 2008)</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Release/ProjectReleases.aspx?ReleaseId=46</link><description>Works with Visual Studio 2008 RTM, Entity Framework Beta 3 and Entity Framework Tools CTP 2.</description><author></author><pubDate>Thu, 24 Jan 2008 19:03:39 GMT</pubDate><guid isPermaLink="false">CREATED RELEASE: Sample EDMX Code Generator V1.0 (Jan 24, 2008) 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=12</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt;   gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;   &lt;/span&gt;&lt;/li&gt;&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;span class="codeInline"&gt; reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt; &lt;/span&gt; &lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt; gacutil /u SampleEdmxCodeGenerator &lt;/span&gt; &lt;/li&gt;&lt;li&gt;Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008: &lt;/li&gt;
&lt;/ol&gt;&lt;span class="codeInline"&gt; reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00} &lt;/span&gt;&lt;br /&gt;&lt;span class="codeInline"&gt; reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC} \SampleEdmxCodeGenerator &lt;/span&gt;&lt;br /&gt;&lt;span class="codeInline"&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Test
&lt;/h4&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Process an EDMX file with SampleEdmxCodeGenerator
&lt;/h4&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt; &lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt; &lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Add and edit CSDL annotations
&lt;/h4&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;/li&gt;&lt;li&gt;Click on “XML Editor” in the “Open With” dialog box&lt;/li&gt;&lt;li&gt;Click OK&lt;/li&gt;&lt;li&gt;The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;/li&gt;&lt;li&gt;If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;/li&gt;
&lt;/ol&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt; &lt;br /&gt;&lt;i&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'&lt;/i&gt;&lt;br /&gt; &lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt; &lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Open an EDMX file with CSDL annotations in the designer
&lt;/h4&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt; &lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt; &lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 19:01:36 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=11</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt;   gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;   &lt;/span&gt;&lt;/li&gt;&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;span class="codeInline"&gt; reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt; &lt;/span&gt; &lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt; gacutil /u SampleEdmxCodeGenerator &lt;/span&gt; &lt;/li&gt;&lt;li&gt;Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008: &lt;span class="codeInline"&gt; reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00} &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;span class="codeInline"&gt; reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC} \SampleEdmxCodeGenerator &lt;/span&gt;&lt;br /&gt;&lt;span class="codeInline"&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator &lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Test
&lt;/h4&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Process an EDMX file with SampleEdmxCodeGenerator
&lt;/h4&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Add and edit CSDL annotations
&lt;/h4&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;/li&gt;&lt;li&gt;Click on “XML Editor” in the “Open With” dialog box&lt;/li&gt;&lt;li&gt;Click OK&lt;/li&gt;&lt;li&gt;The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;/li&gt;&lt;li&gt;If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;/li&gt;
&lt;/ol&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;&lt;i&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'&lt;/i&gt;&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Open an EDMX file with CSDL annotations in the designer
&lt;/h4&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 19:00:23 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=10</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt;   gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;   &lt;/span&gt;&lt;/li&gt;&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;span class="codeInline"&gt; reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt; &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:56:18 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=9</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;span class="codeInline"&gt;   gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;   &lt;/span&gt;&lt;/li&gt;&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;/li&gt;
&lt;/ol&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;&lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:55:36 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=8</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;/li&gt;
&lt;/ol&gt;   {{&lt;br /&gt;   gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;&lt;br /&gt;   
}}&lt;ol&gt;
&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;/li&gt;
&lt;/ol&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;&lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:53:41 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=7</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;/li&gt;
&lt;/ol&gt;   //single line&lt;br /&gt;   gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;&lt;br /&gt;   
}}&lt;ol&gt;
&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;/li&gt;
&lt;/ol&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;&lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:52:34 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=6</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: &lt;/li&gt;
&lt;/ol&gt;   {{ gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;&lt;br /&gt;# Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;br /&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;*NOTE:* RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt; &lt;br /&gt;!!!! Unregister&lt;br /&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:51:35 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command: {{ gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;&lt;/li&gt;
&lt;/ol&gt;# Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;br /&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;*NOTE:* RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt; &lt;br /&gt;!!!! Unregister&lt;br /&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:44:59 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Building and deploying
&lt;/h2&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Build
&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h4&gt;
Register
&lt;/h4&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Exit Visual Studio 2008 if it is running&lt;/li&gt;&lt;li&gt;Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools &lt;b&gt;NOTE:&lt;/b&gt; Run as Administrator if running on Windows Vista.&lt;/li&gt;&lt;li&gt;Type the following command:&lt;/li&gt;
&lt;/ol&gt;gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;/li&gt;
&lt;/ol&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;&lt;b&gt;NOTE:&lt;/b&gt; RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt; &lt;br /&gt;&lt;h4&gt;
Unregister
&lt;/h4&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:42:41 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=3</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Building and deploying
&lt;/h1&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Build
&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;/li&gt;&lt;li&gt;Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;/li&gt;&lt;li&gt;Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;!!Register&lt;br /&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;&lt;br /&gt;4.	Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;br /&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;NOTE: RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt;Unregister&lt;br /&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:40:14 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/sampleedmxcodegen/Wiki/View.aspx?title=Home&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
 &lt;br /&gt;The goal of the Sample EDMX Code Generator is to provide you with enough insight into how the ADO.NET Entity Designer generates code in Visual Studio and hopefully give you a head start with some sample source code.&lt;br /&gt; &lt;br /&gt;SampleEdmxCodeGenerator is not intended for production use; instead, it demonstrates custom tool extensibility via SingleFileGenerator, code generation APIs, code generation events and EDM metadata APIs. The sample is also somewhat incomplete on error handling and has not been tuned for performance, stress, etc.&lt;br /&gt; &lt;br /&gt;&lt;h1&gt;
Building and deploying
&lt;/h1&gt;&lt;b&gt;NOTE:&lt;/b&gt; You don’t need to install the Visual Studio 2008 SDK to use this sample.&lt;br /&gt; &lt;br /&gt;!!Build&lt;br /&gt;#Download and unzip SampleEdmxCodeGenerator.zip to a folder on your hard disk.&lt;br /&gt;#Start Visual Studio 2008 and open SampleEdmxCodeGenerator.sln&lt;br /&gt;#Build the solution to get SampleEdmxCodeGenerator.dll in the project output directory&lt;br /&gt; &lt;br /&gt;!!Register&lt;br /&gt;Building the project does not register SampleEdmxCodeGenerator with Visual Studio; you should do this manually. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /i &amp;lt;full path to SampleEdmxCodeGenerator.dll&amp;gt;&lt;br /&gt;4.	Next, type the following command to register SampleEdmxCodeGenerator with Visual Studio 2008: &lt;br /&gt;reg import &amp;lt;full path to RegisterWithVS.reg&amp;gt;&lt;br /&gt;NOTE: RegisterWithVS.reg is in the same folder as the SampleEdmxCodeGenerator sources.&lt;br /&gt;Unregister&lt;br /&gt;Unregistering SampleEdmxCodeGenerator is pretty much the reverse of the registration operation. If you plan to register and unregister often, it may be a good idea to create a batch file with these steps to make this easier.&lt;br /&gt;1.	Exit Visual Studio 2008 if it is running&lt;br /&gt;2.	Start a Visual Studio 2008 Command Prompt available from Start  All Programs   Visual Studio 2008   Visual Studio Tools&lt;br /&gt;NOTE: Run as Administrator if running on Windows Vista.&lt;br /&gt;3.	Type the following command:&lt;br /&gt;gacutil /u SampleEdmxCodeGenerator&lt;br /&gt;4.	Next, type the following commands exactly as they appear to unregister SampleEdmxCodeGenerator with Visual Studio 2008:&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\CLSID\{322EB3BE-19FB-4B6D-9370-1A6474C60D00}&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}\SampleEdmxCodeGenerator&lt;br /&gt;reg delete HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\SampleEdmxCodeGenerator&lt;br /&gt;Test&lt;br /&gt;The SampleEdmxCodeGenerator sources folder has file called SampleModel.edmx that you can use for basic sniff test purposes.&lt;br /&gt;Process an EDMX file with SampleEdmxCodeGenerator&lt;br /&gt;As you probably noticed by now, an EDMX file’s “Custom Tool” property is set to EntityModelCodeGenerator. Making Visual Studio use SampleEdmxCodeGenerator is pretty simple: select the EDMX file in Solution Explorer and type SampleEdmxCodeGenerator as the “Custom Tool” property value.&lt;br /&gt;Visual Studio will immediately run SampleEdmxCodeGenerator to process the EDMX file. You can force Visual Studio to call SampleEdmxCodeGenerator to process the EDMX contents by right-clicking the EDMX file in Solution Explorer and choosing “Run Custom Tool”.&lt;br /&gt;EntityModelCodeGenerator and SampleEdmxCodeGenerator can live side-by-side with each other. For example, you can have 2 EDMX files in the same project with the “Custom Tool” for one set to EntityModelCodeGenerator and other set to SampleEdmxCodeGenerator.&lt;br /&gt;Add and edit CSDL annotations&lt;br /&gt;Since the ADO.NET Entity Designer has no support to visually add or edit CSDL annotations you’ll need to open the EDMX file in XML Editor to do this. This is easy enough to do as follows:&lt;br /&gt;1.	Right-click on the EDMX file in Solution Explorer and choose “Open With…”&lt;br /&gt;2.	Click on “XML Editor” in the “Open With” dialog box&lt;br /&gt;3.	Click OK&lt;br /&gt;4.	The EDMX file opens in XML Editor instead of the ADO.NET Entity Designer&lt;br /&gt;5.	If you prefer, you can reformat the XML document to make it more legible by pressing Ctrl+A and clicking on the “Reformat Selection” button on the XML Editor toolbar&lt;br /&gt;While the ADO.NET Entity Designer doesn’t support it, you could easily imagine a Visual Studio Addin that shows CSDL annotations in a nice GUI and lets you edit them outside of the designer.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in XML Editor, Visual Studio will show information messages saying something like:&lt;br /&gt;Could not find schema information for the attribute 'http://tempuri.org/SampleAnnotations:ClrAttributes'.&lt;br /&gt;These messages can be safely ignored but if you really care then you can create an XSD for your custom namespace and copy the XSD into %vsinstalldir%\Xml\Schemas. Doing this not only gets rid of the messages but you also get intellisense when you type CSDL annotations in XML Editor.&lt;br /&gt;The parsing logic in SampleEdmxCodeGenerator is pretty simplistic and expects multiple CLR attributes to be separated by ‘;’ and only supports string and bool attribute parameters. You could easily extend the sample to work with more complicated constructs.&lt;br /&gt;As soon as you make a change to the EDMX file, Visual Studio will call SampleEdmxCodeGenerator to process the EDMX contents which will immediately generate classes with the appropriate CLR attributes.&lt;br /&gt;Open an EDMX file with CSDL annotations in the designer&lt;br /&gt;The ADO.NET Entity Designer has no support to visually add or edit CSDL annotations. However, the designer preserves any existing CSDL annotations in the EDMX file and the file is rendered properly.&lt;br /&gt;Thus, it is possible to open an EDMX file in the designer even when it contains CSDL annotations and even when it’s “Custom Tool” property is set to SampleEdmxCodeGenerator. One side-effect of this is classes for any new entities created via the designer will be generated by SampleEdmxCodeGenerator. This may be ok as long as you are aware this is happening under the covers.&lt;br /&gt;When an EDMX file with CSDL annotations is opened in the ADO.NET Entity Designer, Visual Studio will show information messages saying it could not find schema information like it did when the EDMX file was opened in XML Editor.&lt;br /&gt;
&lt;/div&gt;</description><author>elisaf_MSFT</author><pubDate>Thu, 24 Jan 2008 18:39:48 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080124P</guid></item></channel></rss>