<?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 : MEF Import Property</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : Community Forum : MEF Import Property</description>
  <pubDate>Fri, 01 May 2026 14:14:16 -700</pubDate>
  <lastBuildDate>Fri, 08 Feb 2013 18:17:36 -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=3986</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>MEF Import Property : Thanks, got that working. </title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3986&amp;PID=15858#15858</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=579" rel="nofollow">gregweb</a><br /><strong>Subject:</strong> 3986<br /><strong>Posted:</strong> 08-Feb-2013 at 6:17pm<br /><br />Thanks, got that working.]]>
   </description>
   <pubDate>Fri, 08 Feb 2013 18:17:36 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3986&amp;PID=15858#15858</guid>
  </item> 
  <item>
   <title>MEF Import Property :    Greg,Dependencies are only...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3986&amp;PID=15857#15857</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> 3986<br /><strong>Posted:</strong> 08-Feb-2013 at 11:10am<br /><br />Greg,<div>Dependencies are only satisfied if the part in question is managed by MEF. If you simply new up your JetDbInitializer, MEF has no awareness of it and won't satisfy any dependencies. You have two options.</div><div>&nbsp;</div><div>First option, you can manually satisfy the dependencies by passing the JetDbInitializer instance to Composition.BuildUp(). For example you can do that in the JetDbInitializer ctor by calling Composition.BuildUp(this).</div><div>&nbsp;</div><div>The other option, you export the JetDbInitializer and then create the instance by calling Composition.GetInstance&lt;JetDbInitializer&gt;().</div><div>&nbsp;</div><div>&#091;Export, PartCreationPolicy(CreationPolicy.NonShared)&#093;</div><div>public class JetDbInitializer : CreateDatabaseIfNotExists&lt;JetDbContext&gt;<br>    {<br>        &#091;ImportMany&#093;<br>        public IEnumerable&lt;ISeedDatabase&gt; Seeds { get; set; }<br>}</div><span style="font-size:10px"><br /><br />Edited by mgood - 08-Feb-2013 at 11:11am</span>]]>
   </description>
   <pubDate>Fri, 08 Feb 2013 11:10:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3986&amp;PID=15857#15857</guid>
  </item> 
  <item>
   <title>MEF Import Property : In the DbIntializer, instead of...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3986&amp;PID=15856#15856</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=579" rel="nofollow">gregweb</a><br /><strong>Subject:</strong> 3986<br /><strong>Posted:</strong> 08-Feb-2013 at 10:28am<br /><br />In the DbIntializer, instead of one large seed method, I have it broken out into different classes one for each type, using an Interface, ISeedDb.<br /><br />I am then trying to import them through a property on the DbInitializer.  However, I no imports come through:<br /><br />public interface ISeedDatabase {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool HasRoot { get; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void Seed(JetDbContext context);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br /><br /><br />public class JetDbInitializer : CreateDatabaseIfNotExists&lt;JetDbContext&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#091;ImportMany&#093;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public IEnumerable&lt;ISeedDatabase&gt; Seeds { get; set; }<br />}<br /><br /> &#091;Export(typeof(ISeedDatabase)), PartCreationPolicy(CreationPolicy.Shared)&#093;<br />&nbsp;&nbsp;&nbsp;&nbsp;public class SeedPhoneTypes : ISeedDatabase<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public bool HasRoot { get { return false; }}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void Seed(JetDbContext context) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var phoneTypes = new List&lt;PhoneNumberType&gt;<br />&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  new PhoneNumberType {Id = CombGuid.NewGuid(), Name = "Home", Default = true},<br />&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  new PhoneNumberType {Id = CombGuid.NewGuid(), Name = "Work"},<br />&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  new PhoneNumberType {Id = CombGuid.NewGuid(), Name = "Mobile"}<br />&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;phoneTypes.ForEach(e =&gt; context.PhoneNumberTypes.Add(e));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />I am not sure what I am doing wrong.<br /><br />Greg]]>
   </description>
   <pubDate>Fri, 08 Feb 2013 10:28:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3986&amp;PID=15856#15856</guid>
  </item> 
 </channel>
</rss>