<?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 : Can&#039;t override the Default CompositionContext</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Can&#039;t override the Default CompositionContext</description>
  <pubDate>Wed, 15 Apr 2026 04:17:13 -700</pubDate>
  <lastBuildDate>Wed, 04 Apr 2012 16:40:04 -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=3372</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>Can&#039;t override the Default CompositionContext :   Hi Walid,This seems to be...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13232#13232</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> 3372<br /><strong>Posted:</strong> 04-Apr-2012 at 4:40pm<br /><br />Hi Walid,<div><br></div><div>This seems to be a bug in DevForce Silverlight. I was trying my test in a console app and it works. Do the same test in SL and it fails just like you indicated. The Default override was ignored. I'll be filing a bug report.</div><div><br></div><div>NOTE: This post is moved as it proves to be a non-cocktail related issue.</div><span style="font-size:10px"><br /><br />Edited by DenisK - 04-Apr-2012 at 6:59pm</span>]]>
   </description>
   <pubDate>Wed, 04 Apr 2012 16:40:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13232#13232</guid>
  </item> 
  <item>
   <title>Can&#039;t override the Default CompositionContext :  Hi Denis,I did it and it&amp;#039;s...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13220#13220</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=998" rel="nofollow">Walid</a><br /><strong>Subject:</strong> 3372<br /><strong>Posted:</strong> 04-Apr-2012 at 2:00am<br /><br />Hi Denis,<div><br></div><div>I did it and<b> it's not working either</b></div><div><br></div><div>Here is the class where I defined the Default CompositionContext. The main application has a reference on the silverlight Domain hosting this Resolver.</div><div>Note that I have others Resolver, located in others Domain assembly (they might or might not be downloaded by request). Each of them declare their own CompositionContext, only here the Default is overriden.&nbsp;</div><div><br></div><div><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; -: initial initial; -repeat: initial initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:blue;">class</span>&nbsp;<span style="color:#2b91af;">MyCompositionContextResolver</span>&nbsp;:&nbsp;<span style="color:#2b91af;">ICompositionContextResolver</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:blue;">static</span>&nbsp;<span style="color:#2b91af;">CompositionContext</span>&nbsp;MyDefault&nbsp;=&nbsp;<span style="color:#2b91af;">CompositionContext</span>.Default<span style="color:blue;">#if</span>&nbsp;!SILVERLIGHT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.WithGenerator(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">CommonEntityServerSaveInterceptor</span>))<span style="color:blue;">#endif</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.WithName(<span style="color:#2b91af;">CompositionContext</span>.Default.Name); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">CompositionContext</span>&nbsp;GetCompositionContext(<span style="color:blue;">string</span>&nbsp;compositionContextName)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">return</span>&nbsp;<span style="color:blue;">null</span>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;}</pre></div><div><br></div><div>Here is the definition of my Interceptor&nbsp;</div><div><br></div><div><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; -: initial initial; -repeat: initial initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:blue;">class</span>&nbsp;<span style="color:#2b91af;">CommonEntityServerSaveInterceptor</span>:&nbsp;<span style="color:#2b91af;">EntityServerSaveInterceptor</span>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">protected</span>&nbsp;<span style="color:blue;">override</span>&nbsp;<span style="color:blue;">bool</span>&nbsp;ExecuteSave()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">throw</span>&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">Exception</span>(<span style="color:#a31515;">"CommonEntityServerSaveInterceptor"</span>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;}</pre></div><div><br></div><div>Still, I can save entities to my database, no exception as I would have expected.</div><div>Below the log showing devforce doesn't care about the override.&nbsp;</div><div><br></div><div><br></div><div>2012-04-04 10:49:57 &nbsp;IdeaBlade.Core.Composition.CompositionHost:CheckMultiExport CompositionContext: '-IbDefault-' - Probed for any 'IIdGenerator' and found 'IdeaBlade.EntityModel.StoreGeneratedIdGenerator'.&nbsp;</div><div><div>2012-04-04 10:49:57 &nbsp;IdeaBlade.Core.Composition.CompositionHost:CheckMultiExport CompositionContext: '-IbDefault-' - Probed for non-default 'IConcurrencyStrategy' and found no matching exports.&nbsp;</div><div>2012-04-04 10:49:57 &nbsp;IdeaBlade.Core.Composition.CompositionHost:CheckSingleExport CompositionContext: '-IbDefault-' - Probed for default 'IConcurrencyStrategy' and found 'IdeaBlade.EntityModel.DefaultConcurrencyValueSetter'.&nbsp;</div><div>2012-04-04 10:49:57 &nbsp;IdeaBlade.Core.Composition.CompositionHost:CheckMultiExport CompositionContext: '-IbDefault-' - Probed for non-default 'IVerifierProvider' and found no matching exports.&nbsp;</div><div>2012-04-04 10:49:57 &nbsp;IdeaBlade.Core.Composition.CompositionHost:CheckSingleExport CompositionContext: '-IbDefault-' - <b>Probed for any 'EntityServerSaveInterceptor' and found 'IdeaBlade.EntityModel.Server.EntityServerSaveInterceptor</b>'.&nbsp;</div></div><div><br></div><div><br></div><div><br></div><div>Could the <b>ConnectionOption </b>defined in <b>Cocktail </b>(which seems to gice the compositioncontext to the manager) be the cause of this behavior ?&nbsp;</div><div><br></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Wed, 04 Apr 2012 02:00:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13220#13220</guid>
  </item> 
  <item>
   <title>Can&#039;t override the Default CompositionContext : Hi Walid,It looks like GetCompositionContext...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13219#13219</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> 3372<br /><strong>Posted:</strong> 04-Apr-2012 at 12:55am<br /><br />Hi Walid,<div><br></div><div>It looks like GetCompositionContext will not get called when using CompositionContext.Default. I'll be checking with a lead architect to find out whether this behavior is a bug or intended.</div><div><br></div><div>For the time being, to override the default CompositionContext, you can declare a public static variable in your CompositionContextResolver class as follows:</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>public class CompositionContextResolver : ICompositionContextResolver {</div><div>&nbsp; &nbsp; public static CompositionContext MyDefault = CompositionContext.Default</div><div>&nbsp; &nbsp; &nbsp; .WithGenerator(typeof(MyDefaultEntityServerQueryInterceptor))</div><div>&nbsp; &nbsp; &nbsp; .WithGenerator(typeof(MyDefaultEntityServerSaveInterceptor))</div><div>&nbsp; &nbsp; &nbsp; .WithName(CompositionContext.Default.Name);</div></div><div><br></div><div>&nbsp; &nbsp; public CompositionContext GetCompositionContext(string compositionContextName) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //return other custom CompositionContext</div><div>&nbsp; &nbsp; }</div><div>}</div><div></pre></td></tr></table></div>]]>
   </description>
   <pubDate>Wed, 04 Apr 2012 00:55:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13219#13219</guid>
  </item> 
  <item>
   <title>Can&#039;t override the Default CompositionContext : Hi,I am posting my issue in this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13213#13213</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=998" rel="nofollow">Walid</a><br /><strong>Subject:</strong> 3372<br /><strong>Posted:</strong> 03-Apr-2012 at 9:54am<br /><br />Hi,<div><br></div><div>I am posting my issue in this forum as I am guessing it is somehow related to coktail</div><div><br></div><div><br></div><div>I need to have many EntitySaveServerInterceptor in my project. Based on this post (<a href="http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;KW=WithFilter&amp;title=defining-default-compositi&#111;n-c&#111;ntext" target="_blank">http://www.ideablade.com/forum/forum_posts.asp?TID=3344&amp;KW=WithFilter&amp;title=defining-default-composition-context</a>) I created many CompositionContext and overrided the IbDefault one.</div><div><br></div><div>The specifics CompositionContext seems to work, but not the Default one. I tried using both method (with PartNotDiscoverable and with MetadataExport) but without success.</div><div>Using the MetadataExport result in an exception saying there is many EntitySaveServerInterceptor definition (they are all with a different MetadataExport).</div><div><br></div><div>The exemple from the post below works fine. In my project the Default override doesn't. the only difference for me is Cocktail.</div><div>I then tried to modify TempHire in order to &nbsp;have an EntityServerSaveInterceptor with the IbDefault context.</div><div><br></div><div><br></div><div>I have the same issue, it never use it.&nbsp;</div><div>To reproduce it, just replace the content of the&nbsp;<span style="font-family: C&#111;nsolas; font-size: 13px; color: rgb43, 145, 175; ">CompositionContextResolver</span><span style=": white; font-family: C&#111;nsolas; font-size: 13px; ">&nbsp;file with the text below.</span></div><div><br></div><div>Am I forgetting something or it is &nbsp;a bug in cocktail/devforce ?</div><div><br></div><div><br></div><div><span style="font-family: C&#111;nsolas; font-size: 13px; color: blue; ">using</span><span style=": white; font-family: C&#111;nsolas; font-size: 13px; ">&nbsp;System;</span></div><div><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; "><span style="color: blue; ">using</span>&nbsp;IdeaBlade.Core.Composition;</pre><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; "><span style="color: blue; ">#if</span>&nbsp;!SILVERLIGHT<span style="color: blue; ">using</span>&nbsp;System.ComponentModel.Composition;<span style="color: blue; ">using</span>&nbsp;IdeaBlade.EntityModel.Server;<span style="color: blue; ">#endif</span> <span style="color: blue; ">namespace</span>&nbsp;Security.Composition{</pre><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; "><span style="color: blue; ">#if</span>&nbsp;!SILVERLIGHT&nbsp;&nbsp;&nbsp;&nbsp;&#091;<span style="color: rgb43, 145, 175; ">PartNotDiscoverable</span>&#093;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">public</span>&nbsp;<span style="color: blue; ">class</span>&nbsp;<span style="color: rgb43, 145, 175; ">MyServerSaveInterceptor</span>:&nbsp;<span style="color: rgb43, 145, 175; ">EntityServerSaveInterceptor</span>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">protected</span>&nbsp;<span style="color: blue; ">override</span>&nbsp;<span style="color: blue; ">bool</span>&nbsp;ExecuteSave()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">throw</span>&nbsp;<span style="color: blue; ">new</span>&nbsp;<span style="color: rgb43, 145, 175; ">Exception</span>(<span style="color: rgb163, 21, 21; ">"MySaveInterceptor"</span>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;}<span style="color: blue; ">#endif</span> &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">public</span>&nbsp;<span style="color: blue; ">class</span>&nbsp;<span style="color: rgb43, 145, 175; ">CompositionContextResolver</span>&nbsp;:&nbsp;<span style="color: rgb43, 145, 175; ">ICompositionContextResolver</span>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">private</span>&nbsp;<span style="color: blue; ">const</span>&nbsp;<span style="color: blue; ">string</span>&nbsp;TempHireContextName&nbsp;=&nbsp;<span style="color: rgb163, 21, 21; ">"TempHireFake"</span>; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">public</span>&nbsp;<span style="color: blue; ">static</span>&nbsp;<span style="color: rgb43, 145, 175; ">CompositionContext</span>&nbsp;TempHireFake&nbsp;=&nbsp;<span style="color: rgb43, 145, 175; ">CompositionContext</span>.Fake<span style="color: blue; ">#if</span>&nbsp;!SILVERLIGHT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.WithGenerator(<span style="color: blue; ">typeof</span>(<span style="color: rgb43, 145, 175; ">FakeLoginManager</span>))<span style="color: blue; ">#endif</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.WithName(TempHireContextName); <span style="color: blue; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#region</span>&nbsp;ICompositionContextResolver&nbsp;Members &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">public</span>&nbsp;<span style="color: rgb43, 145, 175; ">CompositionContext</span>&nbsp;GetCompositionContext(<span style="color: blue; ">string</span>&nbsp;compositionContextName)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">switch</span>&nbsp;(compositionContextName)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">case</span>&nbsp;TempHireContextName:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">return</span>&nbsp;TempHireFake;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">default</span>:</pre><pre style="font-family: C&#111;nsolas; font-size: 13px; -: initial; -attachment: initial; -origin: initial; -clip: initial; : white; ">                    // the default override&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue; ">return</span>&nbsp;<span style="color: rgb43, 145, 175; ">CompositionContext</span>.Default<span style="color: blue; ">#if</span>&nbsp;!SILVERLIGHT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.WithGenerator(<span style="color: blue; ">typeof</span>(<span style="color: rgb43, 145, 175; ">MyServerSaveInterceptor</span>))<span style="color: blue; ">#endif</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.WithName(<span style="color: rgb43, 145, 175; ">CompositionContext</span>.Default.Name);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<span style="color: blue; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#endregion</span>&nbsp;&nbsp;&nbsp;&nbsp;}}</pre></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br ="Apple-interchange-newline">]]>
   </description>
   <pubDate>Tue, 03 Apr 2012 09:54:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3372&amp;PID=13213#13213</guid>
  </item> 
 </channel>
</rss>