<?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>&#60; web:Blog x:Name=&#34;Brian Lagunas&#34; &#47;&#62; &#187; Entity Framework</title>
	<atom:link href="http://www.brianlagunas.com/index.php/category/entity-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brianlagunas.com</link>
	<description></description>
	<lastBuildDate>Fri, 03 Sep 2010 01:55:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Entity Framework and the &#8220;The invoked member is not supported in a dynamic assembly&#8221; exception.</title>
		<link>http://www.brianlagunas.com/index.php/2010/01/28/the-entity-framework-and-the-the-invoked-member-is-not-supported-in-a-dynamic-assembly-exception/</link>
		<comments>http://www.brianlagunas.com/index.php/2010/01/28/the-entity-framework-and-the-the-invoked-member-is-not-supported-in-a-dynamic-assembly-exception/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 01:36:14 +0000</pubDate>
		<dc:creator>Brian Lagunas</dc:creator>
				<category><![CDATA[Entity Framework]]></category>

		<guid isPermaLink="false">http://brianlagunas.com/2010/01/28/the-entity-framework-and-the-the-invoked-member-is-not-supported-in-a-dynamic-assembly-exception/</guid>
		<description><![CDATA[When you create an entity model, a few mapping files are created for you; namely .cdsl, .ssdl, and .msl.&#160; Right about now you may be saying to yourself, I don’t see those files anywhere. That is because they are actually stored as a resource in the assembly you created your entity model.&#160; When you create [...]]]></description>
			<content:encoded><![CDATA[<p>When you create an entity model, a few mapping files are created for you; namely .cdsl, .ssdl, and .msl.&#160; Right about now you may be saying to yourself, I don’t see those files anywhere. That is because they are actually stored as a resource in the assembly you created your entity model.&#160; When you create your entity model, an entity connection string is also created for you and placed in an App.config file, and may resemble the following:</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">&lt;</span><span style="color: #800000">connectionStrings</span><span style="color: #0000ff">&gt;</span></pre>
<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">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;BATEntities&quot;</span> <span style="color: #ff0000">connectionString</span><span style="color: #0000ff">=&quot;metadata=res://*/BAT.DataModel.csdl|res://*/BAT.DataModel.ssdl|res://*/BAT.DataModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=CREATIV-DESKTOP\MSSQLSERVER2008;Initial Catalog=BoiseAutoTrader;Integrated Security=True;MultipleActiveResultSets=True&amp;quot;&quot;</span> <span style="color: #ff0000">providerName</span><span style="color: #0000ff">=&quot;System.Data.EntityClient&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<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">&lt;/</span><span style="color: #800000">connectionStrings</span><span style="color: #0000ff">&gt;</span></pre>
</p></div>
</div>
<p>The entity connection string tells the EF which assembly to look for the mapping files. By default it is represented by the asterisk (*). The bad thing about this is that the * instructs EF to look in all assemblies in your application domain until it finds them. So, you’re probably thinking that this can cause performance issues, and you are absolutely right about that. But the real problem is when your application uses dynamic assemblies and cannot give out their resources. In this case an exception will be thrown, “The invoked member is not supported in a dynamic assembly”.</p>
<p>So how do we fix this? Simple, just fully qualify your assembly name in your entity connection string by replacing the * with your assembly name as follows:</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">&lt;</span><span style="color: #800000">connectionStrings</span><span style="color: #0000ff">&gt;</span></pre>
<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">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;BATEntities&quot;</span> <span style="color: #ff0000">connectionString</span><span style="color: #0000ff">=&quot;metadata=res://MyAssembly/BAT.DataModel.csdl|res://MyAssembly/BAT.DataModel.ssdl|res://MyAssembly/BAT.DataModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=CREATIV-DESKTOP\MSSQLSERVER2008;Initial Catalog=BoiseAutoTrader;Integrated Security=True;MultipleActiveResultSets=True&amp;quot;&quot;</span> <span style="color: #ff0000">providerName</span><span style="color: #0000ff">=&quot;System.Data.EntityClient&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<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">&lt;/</span><span style="color: #800000">connectionStrings</span><span style="color: #0000ff">&gt;</span></pre>
</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.brianlagunas.com/index.php/2010/01/28/the-entity-framework-and-the-the-invoked-member-is-not-supported-in-a-dynamic-assembly-exception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
