<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dan Rigsby - Coding Up Style &#187; Entity Framework</title>
	<atom:link href="http://www.danrigsby.com/blog/index.php/category/entity-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danrigsby.com/blog</link>
	<description>Developer.Speaker.Blogger</description>
	<lastBuildDate>Tue, 17 Nov 2009 18:29:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Entity Framework 4.0: Scalar and Void Functions</title>
		<link>http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/</link>
		<comments>http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/#comments</comments>
		<pubDate>Wed, 20 May 2009 22:52:10 +0000</pubDate>
		<dc:creator>Dan Rigsby</dc:creator>
				<category><![CDATA[Entity Framework]]></category>

		<guid isPermaLink="false">http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/</guid>
		<description><![CDATA[One feature that was sorely missing in the first version of Entity Framework was the automated ability to work with stored procedures that didn’t return back entities.&#160; This could have been sprocs that returned void, a scalar value, or some other custom construct.&#160; 
Entity Framework v1
In Entity Framework v1 you could create a “Function Import” [...]]]></description>
			<content:encoded><![CDATA[<p>One feature that was sorely missing in the first version of Entity Framework was the automated ability to work with stored procedures that didn’t return back entities.&#160; This could have been sprocs that returned void, a scalar value, or some other custom construct.&#160; </p>
<h2>Entity Framework v1</h2>
<p>In Entity Framework v1 you could create a “Function Import” from these stored procedures types, but there would be no generated code that would give you access to them directly in the ObjectContext object.&#160; You could only access them via pure <a href="http://msdn.microsoft.com/en-us/library/bb387145.aspx">Entity SQL</a>. </p>
<p>To add a “Function Import” you would just add the sproc to your entity model as your normally would, then right-click on the “Function Imports” in the “Model Browser”, and select “Add Function Import…”.&#160; This would bring up the following screen which would allow you to add your function.</p>
<p><a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/5202009103234am.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="5-20-2009 10-32-34 AM" border="0" alt="5-20-2009 10-32-34 AM" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/5202009103234am-thumb.png" width="403" height="295" /></a> </p>
<p>If you selected that the function returned an Entity, then you would be able to access that entity in the ObjectContext. However, if you selected scalar or void, then you would have to manually write some kind of Entity SQL.&#160; It would be nice if these “Function Imports” appeared as operations in the ObjectContext as well.</p>
<h2>Entity Framework 4.0 Solution</h2>
<p>Microsoft finally completed the story for “Function Imports” in Entity Framework 4.0. As you can see in the image below, the “Add Function Import” dialog is virtually the same except for the new option to return a complex type.</p>
<p><a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/520200954225pm.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="5-20-2009 5-42-25 PM" border="0" alt="5-20-2009 5-42-25 PM" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/520200954225pm-thumb.png" width="467" height="364" /></a> </p>
<p>You can select the None and Scalar return types as you could before.&#160; However, when the “Function Import” is created, some new code is injected into the Model code behind file that materializes the stored procedure into an operation on the ObjectContext itself:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> ObjectResult&lt;Nullable&lt;global::System.Int32&gt;&gt; GetProductCountByCategoryId(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    Nullable&lt;global::System.Int32&gt; categoryID)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ObjectParameter categoryIDParameter;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">if</span> (categoryID.HasValue)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        categoryIDParameter = <span style="color: #0000ff">new</span> ObjectParameter(<span style="color: #006080">&quot;CategoryID&quot;</span>, categoryID);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        categoryIDParameter = <span style="color: #0000ff">new</span> ObjectParameter(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #006080">&quot;CategoryID&quot;</span>, </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #0000ff">typeof</span>(global::System.Int32));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">return</span> <span style="color: #0000ff">base</span>.ExecuteFunction&lt;Nullable&lt;global::System.Int32&gt;&gt;(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        <span style="color: #006080">&quot;GetProductCountByCategoryId&quot;</span>, </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        categoryIDParameter);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></div>
</div>
<p>A couple of nice things about this are:</p>
<ol>
<li>No matter what we select as the return type, it wraps it as a Nullable type since a database value can always be null </li>
<li>The results are wrapped in an ObjectResult which makes it consistent with all other queries. </li>
</ol>
<p>And as we expect, we can directly access these operations in our code:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">using</span> (var context = <span style="color: #0000ff">new</span> NorthwindEntities())</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ObjectResult&lt;<span style="color: #0000ff">int</span>?&gt; result =</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        context.GetProductCountByCategoryId(1);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    MessageBox.Show(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        result.FirstOrDefault().Value.ToString());</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&#160;</pre>
<p><!--CRLF--></div>
</div>
<h2>New “Execute” operations</h2>
<p>If you look at the last line of the code generated by “Add Function Import”, you might notice is making a call to a new method called ExecuteFunction&lt;T&gt;.&#160; This method isn’t marked public, but there are two new methods on ObjectContext that we can use to execute functions:</p>
<ol>
<li><strong>int ExecuteStoreCommand</strong>
<p>This method seems to work like “ExecuteCommand” and returns in int representing the result </li>
<li><strong>T ExecuteStoreQuery&lt;T&gt;<br />
      <br /></strong>This appears to be more of a combination of “ExecuteScalar”, “ExecuteNonQuery”, and “ExecuteReader”. </li>
</ol>
<p>These methods give us the ability to run any imported stored procedure in a variety of ways.&#160; Most users, will want to just stick with the generated operations, but its always good to have options!</p>
<div class="wlWriterHeaderFooter" style="text-align:left; margin:0px; padding:4px 4px 4px 4px;"><a href="http://www.dotnetkicks.com/kick/?url=http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.danrigsby.com/blog/index.php/2009/05/20/entity-framework-40-scalar-and-void-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New Screencast: Custom Sprocs in Entity Framework</title>
		<link>http://www.danrigsby.com/blog/index.php/2009/05/20/new-screencast-custom-sprocs-in-entity-framework/</link>
		<comments>http://www.danrigsby.com/blog/index.php/2009/05/20/new-screencast-custom-sprocs-in-entity-framework/#comments</comments>
		<pubDate>Wed, 20 May 2009 14:11:00 +0000</pubDate>
		<dc:creator>Dan Rigsby</dc:creator>
				<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Webcast]]></category>

		<guid isPermaLink="false">http://www.danrigsby.com/blog/index.php/2009/05/20/new-screencast-custom-sprocs-in-entity-framework/</guid>
		<description><![CDATA[ I have a new 8 min 35sec training webcast up over using custom stored procedures in Entity Framework.&#160; This video introduces how to use custom sprocs in your Entity Framework model for inserts, updates, deletes, and custom sprocs for searching.&#160; The video briefly talks about how to work with void and scalar sprocs, but [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/screencast1thumbthumb1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="screencast1thumb-thumb" border="0" alt="screencast1thumb-thumb" align="right" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/screencast1thumbthumb-thumb1.png" width="128" height="128" /></a> I have a new 8 min 35sec training webcast up over using custom stored procedures in Entity Framework.&#160; This video introduces how to use custom sprocs in your Entity Framework model for inserts, updates, deletes, and custom sprocs for searching.&#160; The video briefly talks about how to work with void and scalar sprocs, but doesn’t get far into these as this is a feature that is getting more attention in the next version of Entity Framework.</p>
<p>The video is available through <a href="http://www.jupitermedia.com">JupiterMedia</a> and can be viewed at <a href="http://www.internet.com/video/">http://www.internet.com/video/</a>. Just look for the &quot;Developer Video&quot; titled &quot;Custom Sprocs in Entity Framework&quot;.</p>
<p>Direct links are:    <br /><a title="http://www.internet.com/player/index.php?bcpid=1534611832&amp;bclid=1433966034&amp;bctid=22915014001" href="http://www.internet.com/player/index.php?bcpid=1534611832&amp;bclid=1433966034&amp;bctid=22915014001">http://www.internet.com/player/index.php?bcpid=1534611832&amp;bclid=1433966034&amp;bctid=22915014001</a></p>
<div class="wlWriterHeaderFooter" style="text-align:left; margin:0px; padding:4px 4px 4px 4px;"><a href="http://www.dotnetkicks.com/kick/?url=http://www.danrigsby.com/blog/index.php/2009/05/20/new-screencast-custom-sprocs-in-entity-framework/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.danrigsby.com/blog/index.php/2009/05/20/new-screencast-custom-sprocs-in-entity-framework/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.danrigsby.com/blog/index.php/2009/05/20/new-screencast-custom-sprocs-in-entity-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entity Framework 4.0: Pluralization</title>
		<link>http://www.danrigsby.com/blog/index.php/2009/05/19/entity-framework-40-pluralization/</link>
		<comments>http://www.danrigsby.com/blog/index.php/2009/05/19/entity-framework-40-pluralization/#comments</comments>
		<pubDate>Wed, 20 May 2009 01:00:15 +0000</pubDate>
		<dc:creator>Dan Rigsby</dc:creator>
				<category><![CDATA[Entity Framework]]></category>

		<guid isPermaLink="false">http://www.danrigsby.com/blog/index.php/2009/05/19/entity-framework-40-pluralization/</guid>
		<description><![CDATA[One of the new features in Entity Framework 4.0 (EF v2) is a service call “Pluralization”.&#160; This service is used to convert names of objects form singular and/or plural forms.&#160; For instance, if you have a table in the database that has a plural name such as “Customers”, then Entity Framework will automatically generate both [...]]]></description>
			<content:encoded><![CDATA[<div id="codeSnippetWrapper">One of the new features in Entity Framework 4.0 (EF v2) is a service call “Pluralization”.&#160; This service is used to convert names of objects form singular and/or plural forms.&#160; For instance, if you have a table in the database that has a plural name such as “Customers”, then Entity Framework will automatically generate both object Name and Entity Set Name to “Customers” as well.&#160; The result is that in your code, the name will look like this:</div>
<div>&#160;</div>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<div id="codeSnippet" class="csharpcode">
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">Customers c = <span style="color: #0000ff">new</span> Customers();</pre>
</p></div>
<p><!--CRLF--></div>
</p></div>
</p>
<p>Ideally, it would have been nice for EF to see that the table was a plural name and set the object Name to a singular form.</p>
<p>Now, you may be thinking that this is pretty trivial since you can manually change the generated name, but when when you have dozens or hundreds of tables this can be tedious at best.</p>
<p>To use the PluralizationService when generating an Entity Framework model, you just select the option&quot;Pluralize or singularize generated object names”:<br />
    <br /><a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pluralization" border="0" alt="Pluralization" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization-thumb.png" width="419" height="538" /></a></p>
<p>Or if you are using the EDMGen.exe tool, you can opt in using the <strong>/pluralize</strong> option.</p>
<h3>Example</h3>
<p>In the Northwind database, all the tables have plural names. (Note: It is typically recommended to name your tables in the singular form).</p>
</div>
<p>&#160;<a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pluralization3" border="0" alt="Pluralization3" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization3-thumb.png" width="213" height="239" /></a></p>
<p>When this database is generated using the PluralizationService, the names are set correctly.</p>
<p><a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pluralization1" border="0" alt="Pluralization1" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization1-thumb.png" width="615" height="457" /></a> <a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pluralization2" border="0" alt="Pluralization2" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization2-thumb.png" width="615" height="455" /></a>&#160; </p>
<h2>Manually using the PluralizationService</h2>
<p>The PluralizationService is in the System.Data.Entity.Design.dll under the System.Data.Entity.Design.PluralizationServices namespace. </p>
<p><a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pluralization4" border="0" alt="Pluralization4" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization4-thumb.png" width="668" height="151" /></a> </p>
<p>It is an abstract class and hence, can’t be directly instantiated.&#160; However, there is a static CreateService method on the class to access instances of the service for various cultures.&#160; At this time, the only culture implemented is “en-us”.</p>
<p>It would have been very nice if this were implemented at a more core level of .Net since this could potentially be useful for a lot more than just for Entity Framework design.&#160; Here are some examples using the service:</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// Create an instance of the service for</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// a particular culture (only 'en-us' atm)</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">PluralizationService ps =</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    PluralizationService.CreateService(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">         CultureInfo.GetCultureInfo(<span style="color: #006080">&quot;en-us&quot;</span>));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// Convert strings to plural or singular</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">string</span> pluralName = ps.Pluralize(<span style="color: #006080">&quot;Goose&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">string</span> singularName = ps.Singularize(<span style="color: #006080">&quot;Territories&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// Note: Correctly returns Geese and Territory</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// Check if strings are plural or singular</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">bool</span> isPluralName = ps.IsPlural(<span style="color: #006080">&quot;Sheep&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">bool</span> isSingularName = ps.IsSingular(<span style="color: #006080">&quot;Sheep&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">// Note: Correctly sees both of these <span style="color: #0000ff">as</span> true</pre>
<p><!--CRLF--></div>
</p></div>
</div>
<p><a title="http://blogs.msdn.com/efdesign/archive/2008/12/02/pluralization.aspx" href="http://blogs.msdn.com/efdesign/archive/2008/12/02/pluralization.aspx"></a></p>
</p>
</p>
</p>
<h2>Adding your own pluralization mapping</h2>
<p>There is an interface using by the PluralizationService called ICustomPluralizationMapping that isn’t publicly exposed.&#160; However, since it is implemented, you can cast the service to this interface and make use of the AddWord method to add your own mapping.<a href="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Pluralization5" border="0" alt="Pluralization5" src="http://www.danrigsby.com/blog/wp-content/uploads/2009/05/pluralization5-thumb.png" width="539" height="147" /></a> </p>
<p>In this example, we add a new word called “Foo” with the plural version being “Foos”:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// Create an instance of the service for</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// a particular culture (only 'en-us' atm)</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">PluralizationService ps =</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    PluralizationService.CreateService(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        CultureInfo.GetCultureInfo(<span style="color: #006080">&quot;en-us&quot;</span>));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// Cast to the mapping interface</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">ICustomPluralizationMapping mapping =</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    ps <span style="color: #0000ff">as</span> ICustomPluralizationMapping;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">// Add a new word mapping</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">mapping.AddWord(<span style="color: #006080">&quot;Foo&quot;</span>, <span style="color: #006080">&quot;Foos&quot;</span>);</pre>
<p><!--CRLF--></div>
</div>
<div>You could then use the service to generate the metadata or use it in some other context:</div>
<div id="codeSnippetWrapper">
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">EntityModelSchemaGenerator generator =</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    <span style="color: #0000ff">new</span> EntityModelSchemaGenerator(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        entityContainer,</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        ps);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">var edm = generator.GenerateMetadata(); </pre>
<p><!--CRLF--></div>
</p></div>
</div>
<div class="wlWriterHeaderFooter" style="text-align:left; margin:0px; padding:4px 4px 4px 4px;"><a href="http://www.dotnetkicks.com/kick/?url=http://www.danrigsby.com/blog/index.php/2009/05/19/entity-framework-40-pluralization/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.danrigsby.com/blog/index.php/2009/05/19/entity-framework-40-pluralization/&amp;bgcolor=0080C0&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/"></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.danrigsby.com/blog/index.php/2009/05/19/entity-framework-40-pluralization/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New Webcast: ADO.Net Entity Framework</title>
		<link>http://www.danrigsby.com/blog/index.php/2008/12/11/new-webcast-adonet-entity-framework/</link>
		<comments>http://www.danrigsby.com/blog/index.php/2008/12/11/new-webcast-adonet-entity-framework/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 21:21:45 +0000</pubDate>
		<dc:creator>Dan Rigsby</dc:creator>
				<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Webcast]]></category>

		<guid isPermaLink="false">http://www.danrigsby.com/blog/index.php/2008/12/11/new-webcast-adonet-entity-framework/</guid>
		<description><![CDATA[I have a new 8 min 57 sec training webcast up over ADO.Net Entity Framework.  This is a primer video to help get you started using the technology.  It covers what Entity Framework is, how to get started using it, how to query the database, how to add items to a database, and highlights of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.danrigsby.com/blog/wp-content/uploads/2008/12/screencast1.png"><img style="border-right: 0px; border-top: 0px; display: inline; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px" title="screencast1" src="http://www.danrigsby.com/blog/wp-content/uploads/2008/12/screencast1-thumb.png" border="0" alt="screencast1" width="128" height="128" align="right" /></a>I have a new 8 min 57 sec training webcast up over <a href="http://msdn.microsoft.com/en-us/library/bb399572.aspx">ADO.Net Entity Framework</a>.  This is a primer video to help get you started using the technology.  It covers what Entity Framework is, how to get started using it, how to query the database, how to add items to a database, and highlights of couple of “features”.</p>
<p>The video is available through <a href="http://www.jupitermedia.com">JupiterMedia</a> and can be viewed at <a href="http://www.internet.com/video/">http://www.internet.com/video/</a>. Just look for the &#8220;Developer Video&#8221; titled &#8220;ADO.Net Entity Framework&#8221;.</p>
<p>Direct links are:<br />
<a href="http://www.internet.com/player/index.php?bcpid=1534611832&amp;bclid=1433966034&amp;bctid=4551661001">http://www.internet.com/player/index.php?bcpid=1534611832&amp;bclid=1433966034&amp;bctid=4551661001</a><br />
<a href="http://link.brightcove.com/services/link/bcpid1431564240/bclid1433966034/bctid4551661001">http://link.brightcove.com/services/link/bcpid1431564240/bclid1433966034/bctid4551661001</a></p>
<div class="wlWriterHeaderFooter" style="text-align:left; margin:0px; padding:4px 4px 4px 4px;"><a href="http://www.dotnetkicks.com/kick/?url=http://www.danrigsby.com/blog/index.php/2008/12/11/new-webcast-adonet-entity-framework/"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.danrigsby.com/blog/index.php/2008/12/11/new-webcast-adonet-entity-framework/&amp;bgcolor=FF8000&amp;fgcolor=FFFFFF&amp;border=000000&amp;cbgcolor=D4E1ED&amp;cfgcolor=000000" border="0" alt="DotNetKicks Image" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.danrigsby.com/blog/index.php/2008/12/11/new-webcast-adonet-entity-framework/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

