<?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 : defining default composition context</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : defining default composition context</description>
  <pubDate>Sun, 12 Apr 2026 04:57:30 -700</pubDate>
  <lastBuildDate>Wed, 04 Apr 2012 16:42: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=3344</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>defining default composition context : Another customer had asked the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13233#13233</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 04-Apr-2012 at 4:42pm<br /><br />Another customer had asked the same question here.&nbsp;<a href="http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13232#13232" target="_blank">http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13232#13232</a><div><br></div><div>After further investigation, it turns out that this is a bug in our DevForce Silverlight. (I was testing with a console app previously). I'll be filing a bug report.</div>]]>
   </description>
   <pubDate>Wed, 04 Apr 2012 16:42:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13233#13233</guid>
  </item> 
  <item>
   <title>defining default composition context :      I see. Well, I think...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13037#13037</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 20-Mar-2012 at 1:03pm<br /><br />I see. Well, I think this is one of those concept that's easier to show in a sample solution than to explain.<div><br></div><div>I've created a simple one showing how I create my custom composition context resolver with the 2 discovery methods shown in the DRC.</div><div><br></div><div>Discovery with types -&nbsp;MyCustomCCResolverWithTypes.cs</div><div>Discover with metadata filters -&nbsp;MyCustomCCResolverWithMetadataFilters.cs</div><div><br></div><div>The one with the types is commented out so it doesn't conflict. And also due to the fact that you're already gone down the metadata method of discovery path.</div><div><br></div><div><a href="uploads/912/C&#111;nsole_T11680.zip" target="_blank">uploads/912/Console_T11680.zip</a>&nbsp;(Built against our current version of 6.1.6.0)</div><div><br></div><div>Let me know if this is or is not what you're looking for.</div><span style="font-size:10px"><br /><br />Edited by DenisK - 20-Mar-2012 at 1:08pm</span>]]>
   </description>
   <pubDate>Tue, 20 Mar 2012 13:03:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13037#13037</guid>
  </item> 
  <item>
   <title>defining default composition context : I tested that and they were ignored...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13036#13036</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 20-Mar-2012 at 11:43am<br /><br />I tested that and they were ignored by everything I believe. I did not try building a special CompositionContext for those Em's though, just tried passing the contextName.]]>
   </description>
   <pubDate>Tue, 20 Mar 2012 11:43:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13036#13036</guid>
  </item> 
  <item>
   <title>defining default composition context : Hmm, have you marked your X and...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13033#13033</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 20-Mar-2012 at 11:24am<br /><br />Hmm, have you marked your X and Y SaveInterceptors with System.ComponentModel.Composition.PartNotDiscoverable attribute?]]>
   </description>
   <pubDate>Tue, 20 Mar 2012 11:24:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13033#13033</guid>
  </item> 
  <item>
   <title>defining default composition context : I believe I am asking the wrong...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13032#13032</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 20-Mar-2012 at 10:27am<br /><br />I believe I am asking the wrong questions.<DIV>&nbsp;</DIV><DIV>I currently want all my EM's to not load anything special. I want 2 particular EM's to load a custom saveinterceptor each. So every instance of XEntityManager should load XSaveInterceptor, likewise every YEntityManager should load YSaveInterceptor - everything else should ignore those save interceptors. Those are my thoughts today...</DIV><DIV>&nbsp;</DIV><DIV>I have X and Y Em's loading their interceptors...but all the other Em's try to load them both unless I explicitly give a Context on creation which is needless busy work.</DIV><DIV>&nbsp;</DIV><DIV>My interceptors are defined like:</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>&nbsp;&nbsp;&nbsp; &#091;InheritedExport(typeof(EntityServerSaveInterceptor))&#093;<BR>&nbsp;&nbsp;&nbsp; &#091;ExportMetadata("GCS","X")&#093;<BR>&nbsp;&nbsp;&nbsp; class SaveXInterceptor : EntityServerSaveInterceptor</DIV><DIV></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>My context resolver overrides GetCompositionContext:</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public override CompositionContext GetCompositionContext(string compositionContextName)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var filter = CompositionContext.BuildExportFilter("GCS", compositionContextName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return CompositionContext.Default.WithFilter(filter).WithName(compositionContextName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV><DIV></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>Obviously I am on the wrong path...guide me.</DIV><DIV>&nbsp;</DIV><DIV>Thank you.</DIV>]]>
   </description>
   <pubDate>Tue, 20 Mar 2012 10:27:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13032#13032</guid>
  </item> 
  <item>
   <title>defining default composition context : Bah, I didn&amp;#039;t read the last...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13030#13030</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 20-Mar-2012 at 8:31am<br /><br />Bah, I didn't read the last comment in your code section...that answers&nbsp;my reply. <DIV>&nbsp;</DIV><DIV>So this defines the specific implementations to use for those two types, and the rest of the types are loaded as normal? So if I added two more of a different type (say, login manager) I would get the composition error until I went and added one to this default line?</DIV><DIV>&nbsp;</DIV><DIV>How would I define it such that it would not load any custom types without explicitly declaring the context when creating an EM?</DIV><span style="font-size:10px"><br /><br />Edited by midnit - 20-Mar-2012 at 8:32am</span>]]>
   </description>
   <pubDate>Tue, 20 Mar 2012 08:31:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13030#13030</guid>
  </item> 
  <item>
   <title>defining default composition context : I have seen that in the documentation...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13029#13029</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 20-Mar-2012 at 5:26am<br /><br />I have seen that in the documentation and I admit I did not try it but that was because it did not fit (in my head) what I thought I wanted to do. This "appears" to me that I would have to use MyCompositionContextResolver.MyDefault in every EntityManager constructor to get this composition:<DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>var em = new EntityManager(true, null, DefaultSomething, MyCompositionContextResolver.MyDefault)</DIV><DIV></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>But, since you are repeating it I assume I need to fit it in my head :) Is this going to redefine what CompositionContext.Default means without using actually using MyDefault? I need just the declaration?</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 20 Mar 2012 05:26:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13029#13029</guid>
  </item> 
  <item>
   <title>defining default composition context : Hi midnit;You can &amp;#034;override&amp;#034;...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13025#13025</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 19-Mar-2012 at 5:17pm<br /><br />Hi midnit;<div><br></div><div>You can "override" -IbDefault- context implementation by defining a default CompositionContext in your CompositionContextResolver. The key is with the .WithName extension method.</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>public class MyCompositionContextResolver : BaseCompositionContextResolver {</div><div><br></div><div>&nbsp; public static CompositionContext MyDefault = CompositionContext.Default</div><div>&nbsp; &nbsp; .WithGenerator(typeof(AdminEntityServerSaveInterceptor))</div><div>&nbsp; &nbsp; .WithGenerator(typeof(AdminEntityServerQueryInterceptor))</div><div>&nbsp; &nbsp; .WithName(CompositionContext.Default.Name);</div><div><br></div><div>}</div></div><div><br></div><div>//Any query or save made by an EntityManager created without declaring the context will use the above //AdminEntityServerSaveInterceptor and AdminEntityServerQueryInterceptor</div><div><br></div><div></pre></td></tr></table></div><div><br></div><div>Let me know if this is not what you're looking for.</div>]]>
   </description>
   <pubDate>Mon, 19 Mar 2012 17:17:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13025#13025</guid>
  </item> 
  <item>
   <title>defining default composition context : I am missing a bit regarding how...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13021#13021</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=531" rel="nofollow">midnit</a><br /><strong>Subject:</strong> 3344<br /><strong>Posted:</strong> 19-Mar-2012 at 8:00am<br /><br /><P>I am missing a bit regarding how CompositionContext is working and what I need to do to get my desired results.</P><DIV>Previously we had just 1 save interceptor and life was well. Then we added another save interceptor and life became not so well. So then I read your CompositionContext documentation and life became...a little muddy, but well enough after a little trial and error. I added some metadata to the saveinterceptors and this works well for the entitymanagers where we define the context, but I would like to not have to declare the context on every entitymanager and I get the feeling from the documentation that this IS possible but I am confused as to how.</DIV><DIV>&nbsp;</DIV><DIV>I created a custom CompositionContextResolver and started seeing what happens in GetCompositionContext and I see that without a context defined in the entitymanager constructor...it never gets hit so I can't change its behavior here. So, where can I achieve this? I would like to define what the "-IbDefault-" context means or something to avoid having to declare the context on every entitymanager I create.</DIV><DIV>&nbsp;</DIV><DIV>Please enlighten me :)</DIV>]]>
   </description>
   <pubDate>Mon, 19 Mar 2012 08:00:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;PID=13021#13021</guid>
  </item> 
 </channel>
</rss>