<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://www.codeplex.com/rss.xsl"?><rss version="2.0"><channel><title>patterns &amp; practices - Unity</title><link>http://unity.codeplex.com/project/feeds/rss</link><description>The Unity Application Block &amp;#40;Unity&amp;#41; is a lightweight extensible dependency injection container with support for constructor, property, and method call injection.      Unity addresses the issues faced by developers engaged in component-based software engineering. Modern business applications consist of custom business objects and components that perform specific or generic tasks within the application, in addition to components that individually address cross cutting concerns such as logging, authentication, authorization, caching, and exception handling.       The key to successfully building such applications is to achieve a decoupled or very loosely coupled design. Loosely coupled applications are more flexible and easier to maintain. They are also easier to test during development. You can mock up shims &amp;#40;lightweight mock implementations&amp;#41; of objects that have strong concrete dependencies&amp;#59; such as database connections, network connections, ERP connections, and rich user interface components.       Dependency injection is a prime technique for building loosely coupled applications. It provides ways to handle the dependencies between objects. For example, an object that processes customer information may depend on other objects that access the data store, validate the information, and check that the user is authorized to perform updates. Dependency injection techniques can ensure that the customer class correctly instantiates and populates all of these objects, especially where the dependencies may be abstract.</description><item><title>Created Issue: IndexOutOfRangeException After ApplicationPool Recycle [11791]</title><link>http://unity.codeplex.com/workitem/11791</link><description>It looks like the List within DependencyResolverTracker.AddResolverKey is used in a way which is possibly not be thread-safe.&lt;br /&gt;&lt;br /&gt;This caused us many IndexOutOfRangeExceptions randomly after an application pool recycle.  Simply recycling the application pool again resolved the issue.&lt;br /&gt;&lt;br /&gt;Details of the stack are&lt;br /&gt;&lt;br /&gt;Exception is&amp;#58; IndexOutOfRangeException - Index was outside the bounds of the array.       &amp;#38;&amp;#35;xD&amp;#59;&amp;#38;&amp;#35;xA&amp;#59;-----------------------------------------------&amp;#38;&amp;#35;xD&amp;#59;&amp;#38;&amp;#35;xA&amp;#59;       At the time of the exception, the container was&amp;#58;&amp;#38;&amp;#35;xD&amp;#59;&amp;#38;&amp;#35;xA&amp;#59;&amp;#38;&amp;#35;xD&amp;#59;&amp;#38;&amp;#35;xA&amp;#59;         Resolving Fred.Services.Person.ViewListing,ServiceHost        &amp;#40;mapped from Fred.Services.Person.IViewListing, ServiceHost&amp;#41;&amp;#38;&amp;#35;xD&amp;#59;&amp;#38;&amp;#35;xA&amp;#59; ----&amp;#38;gt&amp;#59;        System.IndexOutOfRangeException&amp;#58; Index was outside the bounds of the array.&amp;#38;&amp;#35;xA&amp;#59;          at System.Collections.Generic.List&amp;#96;1.Add&amp;#40;T item&amp;#41;&amp;#38;&amp;#35;xD&amp;#59;&amp;#38;&amp;#35;xA&amp;#59;         at Microsoft.Practices.ObjectBuilder2.ConstructorSelectorPolicyBase&amp;#96;1.CreateSelectedConstructor&amp;#40;IBuilderContext context, IPolicyList resolverPolicyDestination, ConstructorInfo ctor&amp;#41; in e&amp;#58;&amp;#92;Builds&amp;#92;Unity&amp;#92;UnityTemp&amp;#92;Compile&amp;#92;Unity&amp;#92;Unity&amp;#92;Src&amp;#92;ObjectBuilder&amp;#92;Strategies&amp;#92;BuildPl...&amp;#41;.&amp;#34; time&amp;#61;&amp;#34;2012-02-16T21&amp;#58;14&amp;#58;59.0249474Z&amp;#34;&amp;#62;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;See this discussion for further info on it.&lt;br /&gt;http&amp;#58;&amp;#47;&amp;#47;unity.codeplex.com&amp;#47;discussions&amp;#47;328841&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Rick&lt;br /&gt;</description><author>RickF</author><pubDate>Tue, 21 Feb 2012 21:44:00 GMT</pubDate><guid isPermaLink="false">Created Issue: IndexOutOfRangeException After ApplicationPool Recycle [11791] 20120221094400P</guid></item><item><title>New Post: IndexOutOfRangeException After ApplicationPool Recycle</title><link>http://unity.codeplex.com/discussions/328841</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;The issue seems to be with Unity itself, as resolution methods are supposed to be thread safe.&lt;br /&gt;&lt;br /&gt;I can only recommend that you register an issue in the issue tracker.&lt;/p&gt;
&lt;p&gt;SFence&lt;/p&gt;&lt;/div&gt;</description><author>SFence</author><pubDate>Tue, 21 Feb 2012 12:53:56 GMT</pubDate><guid isPermaLink="false">New Post: IndexOutOfRangeException After ApplicationPool Recycle 20120221125356P</guid></item><item><title>Commented Issue: IBuilderContext.Locator from Unity 1.2 doesn't exist in Unity 2.0 [8028]</title><link>http://unity.codeplex.com/workitem/8028</link><description>Hello&lt;br /&gt;&lt;br /&gt;is there a work around for this breaking change&amp;#63;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Costas&lt;br /&gt;Comments: ** Comment from web user: oligagne ** &lt;p&gt;and how you do this&amp;#63;&amp;#33;&amp;#63;&lt;/p&gt;</description><author>oligagne</author><pubDate>Tue, 21 Feb 2012 02:12:08 GMT</pubDate><guid isPermaLink="false">Commented Issue: IBuilderContext.Locator from Unity 1.2 doesn't exist in Unity 2.0 [8028] 20120221021208A</guid></item><item><title>New Post: IndexOutOfRangeException After ApplicationPool Recycle</title><link>http://unity.codeplex.com/discussions/328841</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi SFence,&lt;/p&gt;
&lt;p&gt;Agree with your conclusions. &amp;nbsp;It does look like the List within DependencyResolverTracker.AddResolverKey could possibly not be thread-safe.&lt;/p&gt;
&lt;p&gt;It is very possible that we have multiple threads simultaneously resolving these dependencies. &amp;nbsp;Is this something we should be guarding against in our code when we're resolving the dependencies or is this an issue with Unity itself?&lt;/p&gt;
&lt;p&gt;It appears that during the AppPool startup somehow this List got corrupted and thus ongoing resolution of only one type was causing us a problem in an isolated part of our website.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thanks&lt;/p&gt;
&lt;p&gt;Rick&lt;/p&gt;&lt;/div&gt;</description><author>rickf</author><pubDate>Mon, 20 Feb 2012 22:46:54 GMT</pubDate><guid isPermaLink="false">New Post: IndexOutOfRangeException After ApplicationPool Recycle 20120220104654P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Yeah, this is an unfortunate corner case due to the internals of the design.&lt;/p&gt;
&lt;p&gt;Basically, all registrations except type mappings are keyed off concrete types, not interfaces. So when you do what you did in the first post, Unity will:&lt;/p&gt;
&lt;p&gt;1) Look up type mapping: ITest -&amp;gt; Test&lt;/p&gt;
&lt;p&gt;2) Look up factory for type Test&lt;/p&gt;
&lt;p&gt;It doesn't matter that you've got a factory registered for ITest in the child container, because by the time you get to that stage in the creation pipeline, the container's no longer looking for ITest.&lt;/p&gt;
&lt;p&gt;That's why doing RegisterType&amp;lt;ITest, ITest&amp;gt; works - it finds a type mapping ITest -&amp;gt; ITest, and then goes looking for a factory for ITest.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description><author>ctavares</author><pubDate>Mon, 20 Feb 2012 22:18:37 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220101837P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Thanks that is what I needed to know.&lt;/p&gt;&lt;/div&gt;</description><author>RafalFurman</author><pubDate>Mon, 20 Feb 2012 16:44:37 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220044437P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;OK, now I get your point. You don't know which Type your factory will create in the end. If you change the registration to&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;child.RegisterType&amp;lt;ITest, ITest&amp;gt;(&lt;span style="color: blue;"&gt;new&lt;/span&gt; InjectionFactory(c =&amp;gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; Test2));
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Identical source and destination types will also solve your problem. It has something to do with the way Unity handles type mappings and build keys.&lt;/p&gt;&lt;/div&gt;</description><author>weberse</author><pubDate>Mon, 20 Feb 2012 15:01:08 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220030108P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;I would. This is only sample code. I write integration layer with some old code that provides me with type factory that I'm supposed to use in certain situation. By understanding it I can determine the type that will be returned form it.&lt;/p&gt;
&lt;p&gt;But what if I couldn't. Or if decision would be made in runtime base on some application state what then?&lt;/p&gt;&lt;/div&gt;</description><author>RafalFurman</author><pubDate>Mon, 20 Feb 2012 14:42:53 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220024253P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;You could also use the non-generic overload of RegisterType&lt;/p&gt;
&lt;p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;child.RegisterType(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(ITest), &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(Test2), &lt;span style="color: blue;"&gt;new&lt;/span&gt; InjectionFactory(c =&amp;gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; Test2()));
&lt;/pre&gt;
&lt;/div&gt;
But if you determine the implementation Type dynamically, why would you create it yourself via a factory and not let Unity decide how best to create an instance of your implementation?&lt;/p&gt;&lt;/div&gt;</description><author>weberse</author><pubDate>Mon, 20 Feb 2012 14:27:50 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220022750P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Thanks, this solution works for me, but isn't that odd that this second type is required? What if I wanted dynamically determine implementation type to use?&lt;/p&gt;&lt;/div&gt;</description><author>RafalFurman</author><pubDate>Mon, 20 Feb 2012 14:23:50 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220022350P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;
&lt;pre&gt;&lt;div style="color: black; background-color: white;"&gt;&lt;pre&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; container = &lt;span style="color: blue;"&gt;new&lt;/span&gt; UnityContainer();
&lt;span style="color: blue;"&gt;var&lt;/span&gt; child = container.CreateChildContainer();
container.RegisterType&amp;lt;ITest, Test&amp;gt;();
child.RegisterType&amp;lt;ITest, Test2&amp;gt;(&lt;span style="color: blue;"&gt;new&lt;/span&gt; InjectionFactory(c =&amp;gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; Test2()));
&lt;span style="color: blue;"&gt;var&lt;/span&gt; sut = child.Resolve&amp;lt;ITest&amp;gt;();
Assert.IsInstanceOfType(sut, &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(Test2));
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;If you provide source and destination type for the registration it works fine.&lt;br /&gt;&lt;/pre&gt;
&lt;/p&gt;&lt;/div&gt;</description><author>weberse</author><pubDate>Mon, 20 Feb 2012 13:51:21 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220015121P</guid></item><item><title>New Post: Registration to child container </title><link>http://unity.codeplex.com/discussions/330962</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Consider code:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; container = &lt;span style="color:blue"&gt;new&lt;/span&gt; UnityContainer();
container.RegisterType&amp;lt;ITest, Test&amp;gt;();
&lt;span style="color:blue"&gt;var&lt;/span&gt; childContainer = container.CreateChildContainer();
childContainer.RegisterType(&lt;span style="color:blue"&gt;typeof&lt;/span&gt;(ITest), &lt;span style="color:blue"&gt;new&lt;/span&gt; InjectionFactory((x) =&amp;gt; &lt;span style="color:blue"&gt;new&lt;/span&gt; Test2()));
&lt;span style="color:blue"&gt;var&lt;/span&gt; result = childContainer.Resolve&amp;lt;ITest&amp;gt;();
Console.WriteLine(result.GetType().FullName);
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I expected to get instance of Test2&amp;nbsp;from child container instead I got Test. Can you explain me why?&lt;/p&gt;
&lt;p&gt;The other test I created works as I expected:&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; container = &lt;span style="color:blue"&gt;new&lt;/span&gt; UnityContainer();
container.RegisterType&amp;lt;ITest, Test&amp;gt;();
&lt;span style="color:blue"&gt;var&lt;/span&gt; childContainer = container.CreateChildContainer();
childContainer.RegisterType&amp;lt;ITest, Test2&amp;gt;();&lt;br&gt;&lt;span style="color:blue"&gt;var&lt;/span&gt; result = childContainer.Resolve&amp;lt;ITest&amp;gt;();
Console.WriteLine(result.GetType().FullName);
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</description><author>RafalFurman</author><pubDate>Mon, 20 Feb 2012 13:03:02 GMT</pubDate><guid isPermaLink="false">New Post: Registration to child container  20120220010302P</guid></item><item><title>New Post: IndexOutOfRangeException After ApplicationPool Recycle</title><link>http://unity.codeplex.com/discussions/328841</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi Rick,&lt;/p&gt;
&lt;p&gt;Do you have multiple threads simultaneously resolving dependencies from the container ?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;</description><author>SFence</author><pubDate>Mon, 20 Feb 2012 11:16:09 GMT</pubDate><guid isPermaLink="false">New Post: IndexOutOfRangeException After ApplicationPool Recycle 20120220111609A</guid></item><item><title>New Post: How to swallow Exception by IInterceptionBehavior?</title><link>http://unity.codeplex.com/discussions/277377</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Try using&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;IMethodReturn&lt;/span&gt;&amp;nbsp;result&amp;nbsp;=&amp;nbsp;getNext().Invoke(input,&amp;nbsp;getNext);&lt;/pre&gt;
&lt;pre&gt;instead of&lt;/pre&gt;
&lt;pre&gt;&lt;pre&gt;&lt;span&gt;IMethodReturn&lt;/span&gt;&amp;nbsp;result&amp;nbsp;=&amp;nbsp;getNext()(input,&amp;nbsp;getNext);
&lt;/pre&gt;
&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</description><author>berkaykurtarab</author><pubDate>Mon, 20 Feb 2012 06:35:17 GMT</pubDate><guid isPermaLink="false">New Post: How to swallow Exception by IInterceptionBehavior? 20120220063517A</guid></item><item><title>New Post: IndexOutOfRangeException After ApplicationPool Recycle</title><link>http://unity.codeplex.com/discussions/328841</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;Last Friday morning we had a very unusual ocurance. &amp;nbsp;We deployed a small change to our website, after which we performed an application pool recycle for it to pick up these changes. &amp;nbsp;Immediately our ASP.Net 4.0 site had issues with one particular
 section (the rest of the site was performing perfectly). &amp;nbsp;We were getting thousands of these exceptions in the logs.&lt;/p&gt;
&lt;p&gt;Exception is: IndexOutOfRangeException - Index was outside the bounds of the array.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp;#xD;&amp;amp;#xA;-----------------------------------------------&amp;amp;#xD;&amp;amp;#xA;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;At the time of the exception, the
 container was:&amp;amp;#xD;&amp;amp;#xA;&amp;amp;#xD;&amp;amp;#xA; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Resolving Fred.Services.Person.ViewListing,ServiceHost&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(mapped from Fred.Services.Person.IViewListing, ServiceHost)&amp;amp;#xD;&amp;amp;#xA; ----&amp;amp;gt;&amp;nbsp;&amp;nbsp;
 &amp;nbsp; &amp;nbsp; &amp;nbsp;System.IndexOutOfRangeException: Index was outside the bounds of the array.&amp;amp;#xA; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;at System.Collections.Generic.List`1.Add(T item)&amp;amp;#xD;&amp;amp;#xA; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;at Microsoft.Practices.ObjectBuilder2.ConstructorSelectorPolicyBase`1.CreateSelectedConstructor(IBuilderContext
 context, IPolicyList resolverPolicyDestination, ConstructorInfo ctor) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPl...).&amp;quot; time=&amp;quot;2012-02-16T21:14:59.0249474Z&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To resolve the issue all we did was recycle the application pool again (however it took us a about 30 minutes to realise this was happening).&lt;/p&gt;
&lt;p&gt;What is strange is we have a farm of 9 web servers all which were recycled around the same time. &amp;nbsp;We also recycle app pools nearly twice a day (for deployments and other changes) and we have never seen this problem before in the 18 months of using Unity.&lt;/p&gt;
&lt;p&gt;We are using Microsoft.Practices.Unity version 2.0.414.0.&lt;/p&gt;
&lt;p&gt;I've also noticed someone else having a very similar problem but with no resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://groups.google.com/group/webformsmvp/browse_thread/thread/d0bc697c702606aa?pli=1"&gt;http://groups.google.com/group/webformsmvp/browse_thread/thread/d0bc697c702606aa?pli=1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is there a bug in Unity that occurs randomly when handling application pool recycles or is there something else we need to know of?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Rick&lt;/p&gt;
&lt;/div&gt;</description><author>RickF</author><pubDate>Sun, 19 Feb 2012 22:34:47 GMT</pubDate><guid isPermaLink="false">New Post: IndexOutOfRangeException After ApplicationPool Recycle 20120219103447P</guid></item><item><title>New Post: Planning for Unity vNext?</title><link>http://unity.codeplex.com/discussions/225592</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;The last checkin for the contrib project was done in 02/2009. Before I would put any effort or code in that project I would like to know&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How are contributions to that project handled? Can you checkin anything as soon as you are a developer on that project?&lt;/li&gt;
&lt;li&gt;Can you change your code later as you see fit?&lt;/li&gt;
&lt;li&gt;Is there some kind of release planning you need to follow?&lt;/li&gt;
&lt;li&gt;Is there some kind of QA in place? E.g. code reviews?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And I agree with @rprimrose: Are there any plans that features from the contrib project will find their way into the Unity core?&lt;/p&gt;&lt;/div&gt;</description><author>weberse</author><pubDate>Mon, 13 Feb 2012 10:43:58 GMT</pubDate><guid isPermaLink="false">New Post: Planning for Unity vNext? 20120213104358A</guid></item><item><title>New Post: Planning for Unity vNext?</title><link>http://unity.codeplex.com/discussions/225592</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Thanks for the thoughts about my IDisposable teardown extension.&lt;/p&gt;
&lt;p&gt;I have previously thought about putting my extension in the contrib project. I'm reluctant to do this as it is already in my toolkit assembly. Granted this means that people need to add another assembly reference, but it means that the code exists in only one place. I would definitely put it in the contrib project if that was some kind of path towards getting it put into the Unity core itself, but am otherwise reluctant.&lt;/p&gt;
&lt;p&gt;Thoughts?&lt;/p&gt;&lt;/div&gt;</description><author>rprimrose</author><pubDate>Mon, 13 Feb 2012 03:46:56 GMT</pubDate><guid isPermaLink="false">New Post: Planning for Unity vNext? 20120213034656A</guid></item><item><title>New Post: ResolveTrampoline&lt;TItem&gt; implementation</title><link>http://unity.codeplex.com/discussions/309268</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Correct me if I'm wrong, but I'm under the impression that Func&amp;lt;T&amp;gt; deferred resolution is, by design, supposed to work as similarly as possible to traditional type resolution. However, the resolution of the deferred dependency in ResolveTrampoline&amp;lt;TItem&amp;gt;.Resolve  (ObjectBuilder\Strategies\BuildPlan\Factory\DeferredResolveBuildPlanPolicy.cs) is done via a completely independent "external" call to the container, that drops any notion of the current build context. Therefore, a lot of&amp;nbsp;functionalities are lost. For example,  this test fixture will fail:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;[TestMethod]
&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; HonoursPerResolveLifetimeManagerWhenResolvingFunc()
{
    &lt;span style="color: blue;"&gt;var&lt;/span&gt; container = &lt;span style="color: blue;"&gt;new&lt;/span&gt; UnityContainer()
        .RegisterType&amp;lt;ILogger, MockLogger&amp;gt;(&lt;span style="color: blue;"&gt;new&lt;/span&gt; PerResolveLifetimeManager());

    &lt;span style="color: blue;"&gt;var&lt;/span&gt; resolver = container.Resolve&amp;lt;Func&amp;lt;ILogger&amp;gt;&amp;gt;();
    &lt;span style="color: blue;"&gt;var&lt;/span&gt; result1 = resolver();
    &lt;span style="color: blue;"&gt;var&lt;/span&gt; result2 = resolver();

    Assert.AreSame(result1, result2);
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is possible to get this test to pass, along with the 977 other tests, by modifying the ResolveTrampoline to accept the build context, and calling&amp;nbsp;IBuilderContext.NewBuildUp rather than&amp;nbsp;IUnityContainer.Resolve. Do you see any contraindication that I should  be aware of ? I suspect there is a good reason why it has not been done by the developers, but I can't see it.&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;&lt;/div&gt;</description><author>SFence</author><pubDate>Sun, 12 Feb 2012 19:03:26 GMT</pubDate><guid isPermaLink="false">New Post: ResolveTrampoline&lt;TItem&gt; implementation 20120212070326P</guid></item><item><title>New Post: How to resolve constructor parameter?</title><link>http://unity.codeplex.com/discussions/291625</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;&lt;a href="In addition to what perfectphase mentioned, h" target="_blank"&gt;Here's a blog post&lt;/a&gt; which shows how use the ParameterOverride (which perfectphase already described) and which also contains a custom resolver which doesn't require passing in the parameter names.&lt;/p&gt;&lt;/div&gt;</description><author>miksu</author><pubDate>Sat, 11 Feb 2012 17:02:04 GMT</pubDate><guid isPermaLink="false">New Post: How to resolve constructor parameter? 20120211050204P</guid></item><item><title>New Post: How to config interception in cfg file?</title><link>http://unity.codeplex.com/discussions/299504</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;You can configure your call handler using Policy Injection. &amp;nbsp;A sample configuration based on your classes would be something like this:&lt;/p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;  &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;unity&lt;/span&gt; &lt;span style="color: red;"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;http://schemas.microsoft.com/practices/2010/unity&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
        
    &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;sectionExtension&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Microsoft.Practices.Unity.Interception.Configuration&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
  
    &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;container&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
      
      &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;extension&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Interception&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;interception&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;

        &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;policy&lt;/span&gt; &lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Policy&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
          &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;matchingRule&lt;/span&gt; &lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;Match&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;UnityCallHandlerConfig.AnyMatchRules, UnityCallHandlerConfig&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;callHandler&lt;/span&gt; &lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;MyInterceptor&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;UnityCallHandlerConfig.MyInterceptor, UnityCallHandlerConfig&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;policy&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
        
      &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;interception&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;

      &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;register&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;UnityCallHandlerConfig.IInterceptable, UnityCallHandlerConfig&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt; &lt;span style="color: red;"&gt;mapTo&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;UnityCallHandlerConfig.BizClass, UnityCallHandlerConfig&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;interceptor&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;TransparentProxyInterceptor&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515;"&gt;policyInjection&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;register&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
    
    &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;container&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
 
  &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515;"&gt;unity&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;--&lt;br /&gt;Randy Levy&lt;br /&gt;Enterprise Library support engineer&lt;br /&gt;&lt;a href="mailto:entlib.support@live.com"&gt;entlib.support@live.com&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;</description><author>randylevy</author><pubDate>Fri, 10 Feb 2012 04:13:24 GMT</pubDate><guid isPermaLink="false">New Post: How to config interception in cfg file? 20120210041324A</guid></item></channel></rss>
