﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>Comments on: Dependency Injection</title>
	<atom:link href="http://punch.ideablade.com/dependency-injection/feed/" rel="self" type="application/rss+xml" />
	<link>http://punch.ideablade.com/dependency-injection/</link>
	<description>Punch is an application development platform that takes the pain out developing Silverlight or WPF enterprise applications.</description>
	<lastBuildDate>Sun, 02 Dec 2012 22:30:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.3</generator>
	<item>
		<title>By: Marcel Good</title>
		<link>http://punch.ideablade.com/dependency-injection/#comment-37</link>
		<dc:creator><![CDATA[Marcel Good]]></dc:creator>
		<pubDate>Mon, 06 Aug 2012 17:31:45 +0000</pubDate>
		<guid isPermaLink="false">http://cocktail.ideablade.com/?p=766#comment-37</guid>
		<description><![CDATA[@Bob Buchanan, the container doesn&#039;t differentiate if you register multiple types with the same contract. It&#039;s up to your code to differentiate when the container gives you all intstances matching a certain contract. 

The trick is in what contract you chose to register your type. In MEF for example a contract can be an interface or a class. In addition you can specify a contract name. 

For example:

public interface IDependency
{
}

[Export(&quot;A&quot;, typeof(IDependency))]
public class DependencyA : IDependency
{}

[Export(&quot;B&quot;, typeof(IDependency))]
public class DependencyB : IDependency
{
}

[Export]
public class SomeClassWithDependencyToA
{
    [ImportingContstructor]
    public SomeClassWithDependencyA([Import(&quot;A&quot;)] IDependency dependency)
    {
    }
}]]></description>
		<content:encoded><![CDATA[<p>@Bob Buchanan, the container doesn&#8217;t differentiate if you register multiple types with the same contract. It&#8217;s up to your code to differentiate when the container gives you all intstances matching a certain contract. </p>
<p>The trick is in what contract you chose to register your type. In MEF for example a contract can be an interface or a class. In addition you can specify a contract name. </p>
<p>For example:</p>
<p>public interface IDependency<br />
{<br />
}</p>
<p>[Export(&#8220;A&#8221;, typeof(IDependency))]<br />
public class DependencyA : IDependency<br />
{}</p>
<p>[Export(&#8220;B&#8221;, typeof(IDependency))]<br />
public class DependencyB : IDependency<br />
{<br />
}</p>
<p>[Export]<br />
public class SomeClassWithDependencyToA<br />
{<br />
    [ImportingContstructor]<br />
    public SomeClassWithDependencyA([Import(&#8220;A&#8221;)] IDependency dependency)<br />
    {<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Buchanan</title>
		<link>http://punch.ideablade.com/dependency-injection/#comment-36</link>
		<dc:creator><![CDATA[Bob Buchanan]]></dc:creator>
		<pubDate>Mon, 06 Aug 2012 16:06:59 +0000</pubDate>
		<guid isPermaLink="false">http://cocktail.ideablade.com/?p=766#comment-36</guid>
		<description><![CDATA[Good article!  So with IOC since you take away the &quot;has a&quot;
object created in the class, how does the container differentiate one instance from another of the same type?]]></description>
		<content:encoded><![CDATA[<p>Good article!  So with IOC since you take away the &#8220;has a&#8221;<br />
object created in the class, how does the container differentiate one instance from another of the same type?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
