<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : EntityServerException when querying EntityManager from our own MEF&#039;ed assembly</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : EntityServerException when querying EntityManager from our own MEF&#039;ed assembly</description>
  <pubDate>Thu, 23 May 2013 12:19:19 -700</pubDate>
  <lastBuildDate>Tue, 06 Mar 2012 06:29:19 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3282</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>EntityServerException when querying EntityManager from our own MEF&#039;ed assembly : For those having the same problem:In...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12900#12900</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=662" rel="nofollow">dpollot44</a><br /><strong>Subject:</strong> 3282<br /><strong>Posted:</strong> 06-Mar-2012 at 6:29am<br /><br />For those having the same problem:<div>In my <i>bootstrapper</i> I played around a bit with how we're loading our plugins.</div><div><br></div><div><div>protected override IEnumerable&lt;System.Reflection.Assembly&gt; SelectAssemblies()</div><div><span ="Apple-tab-span" style="white-space:pre">		</span>{</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>// this NEEDS to be here yo</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(App.CurrentApp.CurrentDomain_AssemblyLoad);</div><div><br></div><div>#if IsDebug</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var extensionsPath = ConfigurationManager.AppSettings&#091;"debugBinPath"&#093;;</div><div>#else</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>var extensionsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ConfigurationManager.AppSettings&#091;"binPath"&#093;);</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">			</span>// Download assemblies from the server!!</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>SyncExtensions(extensionsPath);</div><div>#endif</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!Directory.Exists(extensionsPath))</div><div><span ="Apple-tab-span" style="white-space:pre">				</span>Directory.CreateDirectory(extensionsPath);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var assemblyFilenames = Directory.GetFiles(extensionsPath, "*.dll");</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>var files = assemblyFilenames.Select(af =&gt; new FileInfo(af));</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>files.ToList().ForEach(fi =&gt; {</div><div><span ="Apple-tab-span" style="white-space:pre">				</span>string destFileName = string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, fi.Name);</div><div><span ="Apple-tab-span" style="white-space:pre">				</span>if(File.Exists(destFileName))</div><div><span ="Apple-tab-span" style="white-space:pre">					</span>File.Delete(destFileName);</div><div><span ="Apple-tab-span" style="white-space:pre">				</span>File.Copy(sourceFileName: fi.FullName, destFileName: destFileName);</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>});</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">			</span>var assemblies = files.Select(f =&gt; Assembly.LoadFrom(string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, f.Name)))</div><div><span ="Apple-tab-span" style="white-space:pre">				</span>.Union(new Assembly&#091;&#093; { Assembly.GetExecutingAssembly() })</div><div><span ="Apple-tab-span" style="white-space:pre">				</span>.Union(base.SelectAssemblies());</div><div><span ="Apple-tab-span" style="white-space:pre">			</span></div><div><span ="Apple-tab-span" style="white-space:pre">			</span>return assemblies;</div><div><span ="Apple-tab-span" style="white-space:pre">		</span>}</div></div><div><br></div><div>I had tried manually copying the files into the execution path before start up, but that didn't work. &nbsp;This does however.</div><div>Hopefully this will help someone.</div><div><br></div>]]>
   </description>
   <pubDate>Tue, 06 Mar 2012 06:29:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12900#12900</guid>
  </item> 
  <item>
   <title>EntityServerException when querying EntityManager from our own MEF&#039;ed assembly :   It looks like the problem...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12895#12895</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3282<br /><strong>Posted:</strong> 05-Mar-2012 at 2:42pm<br /><br />It looks like the problem is with the plugin folder.&nbsp; The AssemblyCatalog is loaded correctly, and the CompositionHost "recomposes", but later logic which is looking at types and assemblies is trying to re-load the assembly in question and not finding it in the path.&nbsp; You'll probably also see an assembly load error in the debug log for this assembly.<div>&nbsp;</div><div>We'll get this fixed in the next release, but right now the workaround would be to modify the probing path for the AppDomain, or to copy the assembly into the exe folder and then load the assembly and AssemblyCatalog.&nbsp; In testing I used the deprecated (but still working) AppDomain.CurrentDomain.AppendPrivatePath method to add the plugins folder to get this working.</div><div>&nbsp;</div><div>Also, the various SearchFolders/SearchPatterns stuff is only needed once at application startup, and is ignored after that.</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Mon, 05 Mar 2012 14:42:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12895#12895</guid>
  </item> 
  <item>
   <title>EntityServerException when querying EntityManager from our own MEF&#039;ed assembly : We&amp;#039;re now using 6.1.6.I have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12884#12884</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=662" rel="nofollow">dpollot44</a><br /><strong>Subject:</strong> 3282<br /><strong>Posted:</strong> 03-Mar-2012 at 8:19am<br /><br /><b>We're now using 6.1.6.</b><div>I have the following code within a class in an assembly that will be MEF'd into a shell application (along with a MEF'd in domain model assembly):</div><div><br></div><div><div>IdeaBlade.EntityModel.TransactionSettings.Default =</div><div><span ="Apple-tab-span" style="white-space:pre">				</span>new IdeaBlade.EntityModel.TransactionSettings(System.Transactions.IsolationLevel.ReadCommitted, new TimeSpan(0, 1, 0), false);</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">			</span>IdeaBladeConfig.ConfigFileLocation = @"\...\bla\someconfiglocation";</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>IdeaBlade.Core.Composition.CompositionHost.SearchFolders.Clear();</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>IdeaBlade.Core.Composition.CompositionHost.SearchFolders.Add(@"\...\some plugin folder");</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>IdeaBlade.Core.Composition.CompositionHost.SearchPatterns.Clear();</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>IdeaBlade.Core.Composition.CompositionHost.SearchPatterns.Add("DomainModelAssemblyName.dll");</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">			</span>AssemblyCatalog catalog = new AssemblyCatalog(assembly: Assembly.Load("DomainModelAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"));</div><div><span ="Apple-tab-span" style="white-space:pre">			</span>IdeaBlade.Core.Composition.CompositionHost.Add(catalog: catalog);</div><div><span ="Apple-tab-span" style="white-space:pre">			</span></div><div><span ="Apple-tab-span" style="white-space:pre">			</span>DomainAssembly.EntityManager em = new DomainAssembly.EntityManager();</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">			</span><font color="#ff0000">var entity = em.SomeEntitySet.Where(e =&gt; e.Id.Trim() == "someid").FirstOrDefault();</font></div><div><span ="Apple-tab-span" style="white-space:pre">			</span>var prop = entity.SomePropery;</div></div><div><br></div><div>I get the following exception (thrown at the line in red)</div><div><br></div><div>Type 'IdeaBlade.EntityModel.EntityQueryProxy`1&#091;&#091;DomainModelAssembly.SomeEntitySet, DomainModelAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&#093;&#093;' is not known to the serializer. The following probe assemblies were found during initialization: DomainModelAssembly. &nbsp;Make sure that the assemblies holding your entity model and other known types are in this list. &nbsp;Check that your CompositionHost.SearchPatterns are correct. &nbsp;Also see the debug log to check for assembly load errors.</div><div><br></div><div>I've changed the names of the assemblies/types to protect the innocent, but you get the idea. &nbsp;The exception is telling me that it's found my domain model assembly, and yet I get an exception nonetheless.</div><div><br></div><div>Is there something we're missing??</div>]]>
   </description>
   <pubDate>Sat, 03 Mar 2012 08:19:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12884#12884</guid>
  </item> 
  <item>
   <title>EntityServerException when querying EntityManager from our own MEF&#039;ed assembly : We just added the ability to add...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12732#12732</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3282<br /><strong>Posted:</strong> 22-Feb-2012 at 9:20am<br /><br />We just added the ability to add catalogs to the CompositionHost for non-SL applications in the 6.1.6 bits under development now.&nbsp; This release will be in early March.]]>
   </description>
   <pubDate>Wed, 22 Feb 2012 09:20:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12732#12732</guid>
  </item> 
  <item>
   <title>EntityServerException when querying EntityManager from our own MEF&#039;ed assembly : Ah! I forgot to mention that we&amp;#039;re...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12731#12731</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=865" rel="nofollow">akukucka</a><br /><strong>Subject:</strong> 3282<br /><strong>Posted:</strong> 22-Feb-2012 at 5:53am<br /><br />Ah! &nbsp;I forgot to mention that we're not using Silverlight; our client application is an XBAP. &nbsp;I don't think I have the option to add catalogs to the CompositionHost when not using Silverlight (or I've missed it completely).]]>
   </description>
   <pubDate>Wed, 22 Feb 2012 05:53:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12731#12731</guid>
  </item> 
  <item>
   <title>EntityServerException when querying EntityManager from our own MEF&#039;ed assembly : You should be able to query your...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12724#12724</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3282<br /><strong>Posted:</strong> 21-Feb-2012 at 4:08pm<br /><br />You should be able to query your server from MEF'ed assemblies, but you also have to make sure DevForce knows what you've dynamically loaded.&nbsp; There are a few ways to do this, here's more info - <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/&#111;n-demand-discovery" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/on-demand-discovery</A>.]]>
   </description>
   <pubDate>Tue, 21 Feb 2012 16:08:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12724#12724</guid>
  </item> 
  <item>
   <title>EntityServerException when querying EntityManager from our own MEF&#039;ed assembly : First and foremost, we&amp;#039;re...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12723#12723</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=865" rel="nofollow">akukucka</a><br /><strong>Subject:</strong> 3282<br /><strong>Posted:</strong> 21-Feb-2012 at 2:00pm<br /><br />First and foremost, we're using DevForce 2010 version 6.0.8.0.<div><br></div><div>We've created an application that splits functionality across multiple assemblies that are MEF'ed in at app start up.</div><div><br></div><div>We're having an issue querying a DevForce BOS from within code in one of these MEF'ed assemblies. &nbsp;We can do it from the startup project, but when querying the BOS from code within one of our MEF'ed assemblies we get:</div><div><br></div><div>There was an error while trying to serialize parameter http://ideablade.com/EntityModel:entityQuerySurrogate. The InnerException message was 'Type 'IdeaBlade.EntityModel.EntityQueryProxy`1&#091;&#091;OUR_CUSTOM_TYPE, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&#093;&#093;' with data contract name 'EntityQueryProxyOfOURTYPEcFdpr7Ik:http://ideablade.com/EntityModel' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. &nbsp;Please see InnerException for more details.</div><div><br></div><div>We should be able to query our BOS from MEF'ed assemblies, right?</div><div><br></div><div>Thanks!</div><div><br></div><div>Adam</div>]]>
   </description>
   <pubDate>Tue, 21 Feb 2012 14:00:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3282&amp;PID=12723#12723</guid>
  </item> 
 </channel>
</rss>