<?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 : Exporting templated class</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : Exporting templated class</description>
  <pubDate>Sat, 27 Jun 2026 09:58:45 -700</pubDate>
  <lastBuildDate>Sat, 22 Dec 2012 19:33:26 -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=3856</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>Exporting templated class : What can I say, you&amp;#039;re huge,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15459#15459</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1440" rel="nofollow">giotis</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 22-Dec-2012 at 7:33pm<br /><br /><span id="result_" ="" lang="en"><span ="hps">What can I say</span><span>, you're</span> <span ="hps">huge,</span> </span><span id="result_" ="" lang="en"><span =""> you're</span> <span ="hps">beautiful, </span></span><span id="result_" ="" lang="en"><span ="hps">you covered</span> <span ="hps">the </span></span><span id="result_" ="" lang="en"><span ="hps">issue </span><span ="hps">100</span><span>%,<br></span></span><span id="result_" ="short_text" lang="en"><span ="hps">something</span> <span ="hps">good</span> <span ="hps">came out of</span> <span ="hps">our discussion</span></span>,<br><span id="result_" ="" lang="en"><span ="hps">must</span> <span ="hps">fix the</span> <span ="hps">code</span> <span ="hps">because it is too</span> <span ="hps">painful to</span> <span ="hps">remember</span> <span ="hps">to </span></span><span id="result_" ="" lang="en"><span ="hps">subscribe </span><span ="hps">each time</span> <span ="hps">there</span></span> IHandle.<br>]]>
   </description>
   <pubDate>Sat, 22 Dec 2012 19:33:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15459#15459</guid>
  </item> 
  <item>
   <title>Exporting templated class :   Ok, I was able to reproduce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15458#15458</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 22-Dec-2012 at 6:10pm<br /><br />Ok, I was able to reproduce the issue. TempHire uses the InterceptingCatalog from MefContrib and it looks like it is causing this issue. Unfortunately, the MefContrib project is dead, so this won't get fixed. If you want to use open generics, you gonna have to forgo the use of the InterceptingCatalog. I know of at least one other person who was having issues in their application because of the InterceptingCatalog. I will remove it from future versions in order to discourage its use. <div>&nbsp;</div><div>If you comment out the following method in BootstrapperBase&lt;T&gt; it should work, but now you gonna have to manually subscribe all your ViewModels that receive messages from the EventAggregator with a call to EventFns.Subscribe(this) in the constructor.</div><div>&nbsp;</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected override ComposablePartCatalog PrepareCompositionCatalog()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var cfg = new InterceptionConfiguration().AddInterceptor(this);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new InterceptingCatalog(base.PrepareCompositionCatalog(), cfg);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div>]]>
   </description>
   <pubDate>Sat, 22 Dec 2012 18:10:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15458#15458</guid>
  </item> 
  <item>
   <title>Exporting templated class :  not in SilverLightyour sample...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15457#15457</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1440" rel="nofollow">giotis</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 22-Dec-2012 at 5:40pm<br /><br />not in SilverLight<br><br>your sample is perfect , work in this case<br><br>but something missing when run under TempHire<br><br>I ll try to help you for you help me<br>I check the Composition and the Catalog have the part GridView({0})&nbsp;- exist !<br><br>but when &nbsp;&nbsp;&nbsp; ...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var instance = Composition.GetInstance&lt;IGridView&lt;Foo&gt;&gt;();<br>error "Could not locate any instances of contract IGridView&lt;Foo...<br><br>very sorry if I spend your time <br>many thanks <br><br><span style="font-size:10px"><br /><br />Edited by giotis - 22-Dec-2012 at 5:42pm</span>]]>
   </description>
   <pubDate>Sat, 22 Dec 2012 17:40:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15457#15457</guid>
  </item> 
  <item>
   <title>Exporting templated class :    At this point I&amp;#039;m at...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15456#15456</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 22-Dec-2012 at 4:49pm<br /><br />At this point I'm at a loss as to&nbsp;what you are doing wrong. The example I gave you works just fine. You can download the entire solution from my Skydrive (<a href="http://sdrv.ms/VZ1pSj" target="_blank">http://sdrv.ms/VZ1pSj</a>). If this doesn't work than I don't know. I also have two unit tests in the Cocktail test project to ensure open generics work and those tests pass. I can't spend more time on samples. You gonna have to hire one of our consultants to teach you MEF as so far there doesn't appear to be a bug in Cocktail's handling of open generics.<div></div><div>Just to reiterate, I hope you are not trying to do anything of this in Silverlight, because this won't work in Silverlight as I mentioned before. This will only work in a WPF 4.5 (and Windows 8 Store) applications. </div><span style="font-size:10px"><br /><br />Edited by mgood - 22-Dec-2012 at 5:20pm</span>]]>
   </description>
   <pubDate>Sat, 22 Dec 2012 16:49:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15456#15456</guid>
  </item> 
  <item>
   <title>Exporting templated class : Marcel, many thanksI dont know...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15455#15455</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1440" rel="nofollow">giotis</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 22-Dec-2012 at 11:52am<br /><br />Marcel, many thanks<br><br>I dont know very well MEF<br><br>but when run your example I take back an error "could not locate any instances of contract ...<br><br>after add in Appbootstraper<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; batch.AddExportedValue&lt;IGridView&lt;Customer&gt;&gt;(new GridView&lt;Customer&gt;(null) ); <font color="#FF0000">only for test</font><br><br>is ok.<br><br><br>I use the latest version of TempHire (vs2012) <br><br>&nbsp; a).I hide the "StaffingResourceSearchViewModel" and I create new one like your example<br><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public interface IGridViewGeneric&lt;T&gt; &nbsp;where T : EntityBase{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; T CurrentEntity { get; }</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</div><div><br></div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#091;Export(typeof(IGridViewGeneric&lt;&gt;))&#093;</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public class GridViewGenericViewModel&lt;T&gt; : Screen, IGridViewGeneric&lt;T&gt; where T : EntityBase</div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {...<br><br></div>b)Create a new view named GridViewGenericView<br><br>b).I changed the&nbsp; "ResourceMgtViewModel"<br>&nbsp;&#091;ImportingConstructor&#093;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public ResourceMgtViewModel(IGridViewGeneric&lt;DomainModel.StaffingResource&gt; searchPane, .....<br><br><br>but took back the same error "could not locate any instances of contract IGridViewGeneric&lt;DomainModel.StaffingResource...<br><br>I think MEF dont find the instance <br>If you like to anwser me please with TempHire example (I mean temphire entities)<br><br><br><br><br><br>]]>
   </description>
   <pubDate>Sat, 22 Dec 2012 11:52:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15455#15455</guid>
  </item> 
  <item>
   <title>Exporting templated class : Here&amp;#039;s a very silly example...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15454#15454</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 22-Dec-2012 at 12:12am<br /><br />Here's a very silly example that works just fine for me. I'm not sure what's going on with your code. There's something you are not showing me.&nbsp;<div><br></div><div><div>using System.ComponentModel.Composition;</div><div>using Caliburn.Micro;</div><div>using Cocktail;</div><div>using IdeaBlade.EntityModel;</div><div>using Microsoft.VisualStudio.TestTools.UnitTesting;</div><div><br></div><div>public interface IGridView&lt;T&gt; &nbsp;where T : IEntity</div><div>{</div><div>&nbsp; &nbsp; T CurrentEntity { get; }</div><div>}</div><div><br></div><div>&#091;Export(typeof(IGridView&lt;&gt;))&#093;</div><div>public class GridView&lt;T&gt; : Screen, IGridView&lt;T&gt; where T : IEntity</div><div>{</div><div>&nbsp; &nbsp; private readonly IDialogManager _dialogManager;</div><div>&nbsp; &nbsp; private T _currentEntity;</div><div><br></div><div>&nbsp; &nbsp; &#091;ImportingConstructor&#093;</div><div>&nbsp; &nbsp; public GridView(IDialogManager dialogManager)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; _dialogManager = dialogManager;</div><div>&nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; public T CurrentEntity</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; get { return _currentEntity; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; private set</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Equals(value, _currentEntity)) return;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _currentEntity = value;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NotifyOfPropertyChange(() =&gt; CurrentEntity);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>namespace GenericExportTests</div><div>{</div><div>&nbsp; &nbsp; &#091;TestClass&#093;</div><div>&nbsp; &nbsp; public class GenericExportExample</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;TestMethod&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public void ShouldInstantiateGenericViewModel()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var bootstrapper = new CocktailMefBootstrapper&lt;object&gt;(false);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var instance = Composition.GetInstance&lt;IGridView&lt;Customer&gt;&gt;();</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.IsNotNull(instance);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div>}</div></div><div><br></div>]]>
   </description>
   <pubDate>Sat, 22 Dec 2012 00:12:06 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15454#15454</guid>
  </item> 
  <item>
   <title>Exporting templated class : I want to create Generic ViewModelsor...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15453#15453</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1440" rel="nofollow">giotis</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 21-Dec-2012 at 7:36pm<br /><br />I want to create Generic ViewModels<br><br>or I making wrong to follow this way?<br><br>any help Marcel ?<br>]]>
   </description>
   <pubDate>Fri, 21 Dec 2012 19:36:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15453#15453</guid>
  </item> 
  <item>
   <title>Exporting templated class :  Cocktail 2.2.0I looked at Cocktail...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15452#15452</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1440" rel="nofollow">giotis</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 21-Dec-2012 at 6:05pm<br /><br />Cocktail 2.2.0<br><br>I looked at Cocktail sourse code(Test project) but not work<br>is still null<br><br>any other example to working ?<br><span style="font-size:10px"><br /><br />Edited by giotis - 21-Dec-2012 at 6:15pm</span>]]>
   </description>
   <pubDate>Fri, 21 Dec 2012 18:05:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15452#15452</guid>
  </item> 
  <item>
   <title>Exporting templated class :    Which version of Cocktail...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15451#15451</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 21-Dec-2012 at 5:11pm<br /><br />Which version of Cocktail are you using?You need to use 2.0.5 or higher. There was a fix in 2.0.5 for this, see release notes.<div>&nbsp;</div><div><a href="http://drc.ideablade.com/devforce-2012/bin/view/&#068;ocumentati&#111;n/cocktail-release-notes#H2.0.5" target="_blank">http://drc.ideablade.com/devforce-2012/bin/view/Documentation/cocktail-release-notes#H2.0.5</a></div><span style="font-size:10px"><br /><br />Edited by mgood - 21-Dec-2012 at 5:15pm</span>]]>
   </description>
   <pubDate>Fri, 21 Dec 2012 17:11:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15451#15451</guid>
  </item> 
  <item>
   <title>Exporting templated class : I tried by your example, to create...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15450#15450</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1440" rel="nofollow">giotis</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 21-Dec-2012 at 4:20pm<br /><br /><span id="result_" ="short_text" lang="en"><span ="hps">I tried</span> <span ="hps">by</span> <span ="hps">your example,</span> <span ="hps">to</span> <span ="hps">create generic ViewModel but failed<br><br>&nbsp; &#091;Export(typeof(</span></span><span id="result_" ="short_text" lang="en"><span ="hps"><span id="result_" ="short_text" lang="en"><span ="hps">GridViewViewModel</span></span>&lt;&gt;))&#093;<br>&nbsp; public class GridViewViewModel&lt;T&gt; : Screen, IHandle&lt;SavedMessage&gt; where T : DomainModel.EntityBase&nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ..... copy from StaffingResourceSearchViewModel<br><br>or with I</span></span><span id="result_" ="short_text" lang="en"><span ="hps"><span id="result_" ="short_text" lang="en"><span ="hps">nterface <br><br></span></span>&nbsp;public interface IGridView&lt;T&gt;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void Start();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T CurrentStaffingResource { get; set; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;<br>&nbsp;&nbsp;&nbsp; }<br><br></span></span><span id="result_" ="short_text" lang="en"><span ="hps">&nbsp; &#091;Export(typeof(</span></span><span id="result_" ="short_text" lang="en"><span ="hps">IGridView</span></span><span id="result_" ="short_text" lang="en"><span ="hps">&lt;&gt;))&#093;<br>&nbsp; public class GridViewViewModel&lt;T&gt; : Screen, </span></span><span id="result_" ="short_text" lang="en"><span ="hps"><span id="result_" ="short_text" lang="en"><span ="hps">IGridView&lt;T&gt;</span></span>, IHandle&lt;SavedMessage&gt; where T :&nbsp;&nbsp; DomainModel.EntityBase&nbsp;&nbsp;&nbsp; {<br></span></span>&nbsp; ....<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var viewModel= Composition.GetInstance&lt;IGridView&lt;DomainModel.StaffingResource&gt;&gt;();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewModel is null<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MEF don't create viewModels?<br><br>&nbsp;In fact is possible?<br><br>thank you for your time]]>
   </description>
   <pubDate>Fri, 21 Dec 2012 16:20:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15450#15450</guid>
  </item> 
  <item>
   <title>Exporting templated class :    Based on what you are showing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15425#15425</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1005" rel="nofollow">mgood</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 18-Dec-2012 at 8:29am<br /><br />Based on what you are showing here, you are exporting as IDashBoard&lt;Gauge&lt;ISnapshot&gt;, ISnapshot&gt;)) and the only line that isn't commented out is where you are trying to get instances of&nbsp;type IDashBoard&lt;Indicatore&lt;ISnapshot&gt;, ISnapshot&gt; directly from Cocktail.Composition. Those are not the same type contracts, so you won't get anything. The export and import&nbsp;contracts&nbsp;must match. You can also export/import by name if the type is too restrictive. <div>&nbsp;</div><div>&#091;Export("Foo")&#093;</div><div>public class SomeClass {}</div><div>&nbsp;</div><div>&#091;Export&#093;</div><div>public class AnotherClass</div><div>{</div><div>&nbsp;&nbsp;&nbsp;&nbsp; &#091;ImportingConstructor&#093;</div><div>&nbsp;&nbsp;&nbsp;&nbsp; public AnotherClass(&#091;Import("Foo")&#093; object foo) {}</div><div>}</div><div>&nbsp;</div><div>The other option is open generics if you are developing on .NET 4.5. Unfortunately, open generics are not supported on Silverlight.</div><div>&nbsp;</div><div>&#091;Export(typeof(IDashBoard&lt;,&gt;)&#093;</div><div>public GenericDashBoard&lt;T, Y&gt; : IDashBoard&lt;T,Y&gt;</div><div>{</div><div>}</div><div>&nbsp;</div><div>&#091;Export&#093;</div><div>public class Foo</div><div>{</div><div>&nbsp;&nbsp;&nbsp; &#091;ImportingConstructor&#093;</div><div>&nbsp;&nbsp;&nbsp; public Foo(IDashBoard&lt;Indicatore&lt;ISnapshot&gt;, ISnapshot&gt; dashboard) {}</div><div>}</div><span style="font-size:10px"><br /><br />Edited by mgood - 18-Dec-2012 at 8:30am</span>]]>
   </description>
   <pubDate>Tue, 18 Dec 2012 08:29:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15425#15425</guid>
  </item> 
  <item>
   <title>Exporting templated class : Hello,I&amp;#039;m lost in a cave...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15424#15424</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1136" rel="nofollow">pponzano</a><br /><strong>Subject:</strong> 3856<br /><strong>Posted:</strong> 18-Dec-2012 at 1:27am<br /><br />Hello,<br>I'm lost in a cave with Exporting with templates...<br><br>before I have had an interface of type IDashboard that has an ID (int) and a collection of Items of type Gauge<br><br>Now I've been asked if it's possible to define another type of Gauge and continue using existing code structure..so I've defined those class<br><br><table width="99%"><tr><td><pre class="BBcode"><br>&nbsp; &#091;Export(typeof(IDashBoard&lt;Gauge&lt;ISnapshot&gt;, ISnapshot&gt;))&#093;<br>&nbsp;&nbsp;&nbsp; public class DashboardViewModel : DashBoardBase&lt;Indicatore&lt;SNAPSHOT_INDICATORE_SELECT_Result&gt;, SNAPSHOT_INDICATORE_SELECT_Result&gt;<br>&nbsp;&nbsp;&nbsp; {<br>...<br>}<br><br>&nbsp;public class DashBoardBase&lt;T,Y&gt; : Screen, IDashBoard&lt;T, Y&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where T : GaugeBase&lt;Y&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where Y : ISnapshot<br>&nbsp;&nbsp;&nbsp; {<br>...<br>}<br><br>&nbsp;public class GaugeBase&lt;T&gt; : INotifyPropertyChanged where T:ISnapshot<br>&nbsp;{<br>...<br>}<br><br>&nbsp;public interface ISnapshot<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DateTime DT_TS { get; set; }<br>&nbsp;&nbsp;&nbsp; }<br><br>public interface IDashBoard&lt;T,Y&gt; : INotifyPropertyChanged <br>&nbsp;&nbsp;&nbsp; where T : GaugeBase&lt;Y&gt;<br>&nbsp;&nbsp;&nbsp; where Y : ISnapshot<br>{<br>&nbsp;&nbsp;&nbsp; BindableCollection&lt;T&gt; DataItems { get; set; }<br><br>&nbsp;&nbsp;&nbsp; T SelectedDataItem { get; set; }<br><br>&nbsp;&nbsp;&nbsp; int IdDashBoard { get; set; }<br><br>&nbsp;&nbsp;&nbsp; int IdLayout { get; }<br>...<br>}<br></pre></td></tr></table><br><br>Before I had a dashboardfactory of type<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#091;ImportingConstructor&#093;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public DashBoardFactory()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&#091;ImportMany(typeof(IDashboard))&#093; IEnumerable&lt;IDashboard listaIndicatori<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.listaIndicatori = listaIndicatori;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>and it was working... now I've tried all the ways but I'm not able to set the export so that my dashboardfactory can get items<br><br>&nbsp;&nbsp; &#091;ImportingConstructor&#093;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public DashBoardFactory()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&#091;ImportMany(typeof(DashBoardBase&lt;GaugeBase&lt;ISnapshot&gt;, ISnapshot&gt;))&#093; IEnumerable&lt;DashBoardBase&lt;GaugeBase&lt;ISnapshot&gt;, ISnapshot&gt;&gt; listaIndicatori<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.listaIndicatori = listaIndicatori;<br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var items = Cocktail.Composition.GetInstances&lt;IDashBoard&lt;Indicatore&lt;ISnapshot&gt;, ISnapshot&gt;&gt;();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int count = items.Count(); //0 or it says it cannot cast to type...<br>&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>Any suggestion?<br>Thanks<br>]]>
   </description>
   <pubDate>Tue, 18 Dec 2012 01:27:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3856&amp;PID=15424#15424</guid>
  </item> 
 </channel>
</rss>