<?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: Contextual Awareness &#8211; Making your container behave intelligently</title>
	<atom:link href="http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/</link>
	<description>Just another LosTechies site</description>
	<lastBuildDate>Mon, 07 May 2012 07:05:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: mbratton</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-80</link>
		<dc:creator>mbratton</dc:creator>
		<pubDate>Thu, 07 Oct 2010 13:22:14 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-80</guid>
		<description>No... it&#039;s just another type of model binding at the simplest level.</description>
		<content:encoded><![CDATA[<p>No&#8230; it&#8217;s just another type of model binding at the simplest level.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: flipdoubt</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-79</link>
		<dc:creator>flipdoubt</dc:creator>
		<pubDate>Thu, 07 Oct 2010 06:05:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-79</guid>
		<description>Since Siege passes the services in to the action, doesn&#039;t this affect how you wire up your routes? Apparently not, because I can&#039;t find anything about routes in your post, but I am confused by why you do not have to reach into the container to pull out services to put into your routes. Am I way off base?</description>
		<content:encoded><![CDATA[<p>Since Siege passes the services in to the action, doesn&#8217;t this affect how you wire up your routes? Apparently not, because I can&#8217;t find anything about routes in your post, but I am confused by why you do not have to reach into the container to pull out services to put into your routes. Am I way off base?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mbratton</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-78</link>
		<dc:creator>mbratton</dc:creator>
		<pubDate>Sun, 19 Sep 2010 22:39:50 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-78</guid>
		<description>Mmm.... I dunno. Context, to me, is a very different thing than registrations. I&#039;m not sure the way you&#039;re suggesting to do it would scale to cover the scenarios I&#039;d want to cover ... but I&#039;ll take your word for it on this one :)

Thank you for showing me more about StructureMap, though.</description>
		<content:encoded><![CDATA[<p>Mmm&#8230;. I dunno. Context, to me, is a very different thing than registrations. I&#8217;m not sure the way you&#8217;re suggesting to do it would scale to cover the scenarios I&#8217;d want to cover &#8230; but I&#8217;ll take your word for it on this one <img src='http://lostechies.com/marcusbratton/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thank you for showing me more about StructureMap, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Clowers</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-77</link>
		<dc:creator>Robin Clowers</dc:creator>
		<pubDate>Sun, 19 Sep 2010 22:31:23 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-77</guid>
		<description>I see your point about the context being separate from other objects in the container, although I&#039;m not sure how useful the distinction is.

The implementation of your second example looks pretty much the same:

  var container = new Container(x =&gt;

               x.For&lt;IAccountService&gt;().ConditionallyUse(c =&gt;

               {

                   c.If(context =&gt; context.GetInstance&lt;User&gt;().Account.Balance &gt;= 0).ThenIt.Is.Type&lt;WellFundedAccountService&gt;();

                   c.If(context =&gt; context.GetInstance&lt;User&gt;().Account.Balance &lt; 0).ThenIt.Is.Type&lt;OverdrawnAccountService&gt;();

                   c.If(context =&gt; context.GetInstance&lt;SystemStatus&gt;().IsOffline).ThenIt.Is.Type&lt;SystemUnavailableAccountService&gt;();

               }));

Then you have to register the user in the container:

  container.Configure(c =&gt; c.For&lt;User&gt;().Use(currentUser));

Likewise in the catch method, you register the system status:

  container.Configure(c =&gt; c.For&lt;SystemStatus&gt;().Use(new SystemStatus { IsOffline = true, MinutesUntilOnline = 5 ));
</description>
		<content:encoded><![CDATA[<p>I see your point about the context being separate from other objects in the container, although I&#8217;m not sure how useful the distinction is.</p>
<p>The implementation of your second example looks pretty much the same:</p>
<p>  var container = new Container(x =></p>
<p>               x.For<iaccountservice>().ConditionallyUse(c =></p>
<p>               {</p>
<p>                   c.If(context => context.GetInstance<user>().Account.Balance >= 0).ThenIt.Is.Type<wellfundedaccountservice>();</p>
<p>                   c.If(context => context.GetInstance<user>().Account.Balance < 0).ThenIt.Is.Type<OverdrawnAccountService>();</p>
<p>                   c.If(context => context.GetInstance<systemstatus>().IsOffline).ThenIt.Is.Type<systemunavailableaccountservice>();</p>
<p>               }));</p>
<p>Then you have to register the user in the container:</p>
<p>  container.Configure(c => c.For<user>().Use(currentUser));</p>
<p>Likewise in the catch method, you register the system status:</p>
<p>  container.Configure(c => c.For<systemstatus>().Use(new SystemStatus { IsOffline = true, MinutesUntilOnline = 5 ));<br />
</systemstatus></user></systemunavailableaccountservice></systemstatus></user></wellfundedaccountservice></user></iaccountservice></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mbratton</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-76</link>
		<dc:creator>mbratton</dc:creator>
		<pubDate>Fri, 17 Sep 2010 23:04:18 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-76</guid>
		<description>@bordev

Well, upon reflection there are cases where it could be business-y logic. Maybe I want to pick implementations based on some business rule.

But... in the end I still think of that sort of thing as noise. Anytime I have to deal with picking an implementation, it&#039;s noise to me. Doesn&#039;t matter if business rules are driving it.

Siege has a construct where you can bundle things like this together. We bundle similar registrations together as cohesive units for a variety of reasons... portability of registrations across apps, for example. Another reason may be to encapsulate that sort of business logic together. The construct is called Using.Convention. 

I still think that decisions about which type to create belong in the container. I get the concern about the rules ... and honestly I could probably split those out into encapsulated objects that could be given to the container versus constructed directly into it.

I&#039;m going to think about that one ... I think maybe there is a case for both usages. Thanks for the food for thought!</description>
		<content:encoded><![CDATA[<p>@bordev</p>
<p>Well, upon reflection there are cases where it could be business-y logic. Maybe I want to pick implementations based on some business rule.</p>
<p>But&#8230; in the end I still think of that sort of thing as noise. Anytime I have to deal with picking an implementation, it&#8217;s noise to me. Doesn&#8217;t matter if business rules are driving it.</p>
<p>Siege has a construct where you can bundle things like this together. We bundle similar registrations together as cohesive units for a variety of reasons&#8230; portability of registrations across apps, for example. Another reason may be to encapsulate that sort of business logic together. The construct is called Using.Convention. </p>
<p>I still think that decisions about which type to create belong in the container. I get the concern about the rules &#8230; and honestly I could probably split those out into encapsulated objects that could be given to the container versus constructed directly into it.</p>
<p>I&#8217;m going to think about that one &#8230; I think maybe there is a case for both usages. Thanks for the food for thought!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bordev</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-75</link>
		<dc:creator>bordev</dc:creator>
		<pubDate>Fri, 17 Sep 2010 22:46:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-75</guid>
		<description>mbratton&gt; the fact that I would consider it as business logic is because you&#039;re throwing in environmental applicaton variables in the container&#039;s equasion which determine the plumbing during runtime.

IMO application plumbing needs only be done at design time and scattered business logic avoided so I&#039;m not really convinced.

though it&#039;s an interesting thin line where responsibilities of container starts/ends.

</description>
		<content:encoded><![CDATA[<p>mbratton> the fact that I would consider it as business logic is because you&#8217;re throwing in environmental applicaton variables in the container&#8217;s equasion which determine the plumbing during runtime.</p>
<p>IMO application plumbing needs only be done at design time and scattered business logic avoided so I&#8217;m not really convinced.</p>
<p>though it&#8217;s an interesting thin line where responsibilities of container starts/ends.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mbratton</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-74</link>
		<dc:creator>mbratton</dc:creator>
		<pubDate>Fri, 17 Sep 2010 21:12:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-74</guid>
		<description>Hi bordev,

I don&#039;t really consider that to be implementation selection to be controller logic or business logic. I consider it to be #1 responsibility of the container. At the end of the day all that container setup says is this:

When I select Vendor X on this page, I want to get an instance of VendorXService so that when I call a method (say, service.Submit()) it sends the info to the correct vendor.

I don&#039;t see anything inherently wrong with moving those sorts of decisions out of your controller and into your container. It&#039;s application plumbing moreso than anything.</description>
		<content:encoded><![CDATA[<p>Hi bordev,</p>
<p>I don&#8217;t really consider that to be implementation selection to be controller logic or business logic. I consider it to be #1 responsibility of the container. At the end of the day all that container setup says is this:</p>
<p>When I select Vendor X on this page, I want to get an instance of VendorXService so that when I call a method (say, service.Submit()) it sends the info to the correct vendor.</p>
<p>I don&#8217;t see anything inherently wrong with moving those sorts of decisions out of your controller and into your container. It&#8217;s application plumbing moreso than anything.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bordev</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-73</link>
		<dc:creator>bordev</dc:creator>
		<pubDate>Fri, 17 Sep 2010 20:50:21 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-73</guid>
		<description>hi mbratton,

What I&#039;m wondering is what is the real advantage of moving typical controller logic - choosing the right implementation based on some UI selection - to the container in the registry section and make it smart?

This leakage of controller logic into the container clouds the distinct create/destroy concerns of the container and I wonder if this is a good thing regarding maintainability of your UI and controllers in this example?

Losing the service locator tp make stuff less ugly is one thing but I think it might be better to  leave the implementation selection in the controller. (Then inject a typed-factory using the windsor to lose the service locator.)










</description>
		<content:encoded><![CDATA[<p>hi mbratton,</p>
<p>What I&#8217;m wondering is what is the real advantage of moving typical controller logic &#8211; choosing the right implementation based on some UI selection &#8211; to the container in the registry section and make it smart?</p>
<p>This leakage of controller logic into the container clouds the distinct create/destroy concerns of the container and I wonder if this is a good thing regarding maintainability of your UI and controllers in this example?</p>
<p>Losing the service locator tp make stuff less ugly is one thing but I think it might be better to  leave the implementation selection in the controller. (Then inject a typed-factory using the windsor to lose the service locator.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mbratton</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-72</link>
		<dc:creator>mbratton</dc:creator>
		<pubDate>Fri, 17 Sep 2010 20:34:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-72</guid>
		<description>Hi Robin,

I would say &quot;not exactly&quot;. The core distinction between how I&#039;m doing this and how StructureMap is doing this is that I would say my stuff is more adaptive.

Awareness is just one way the container is able to understand what you want to do. My goal is to decouple what can be considered context and where it comes from away from making the container the end-all, be-all for determining what context &quot;is&quot;.

For Siege, context can be ... anything. It can be information about the current user. It could be the time of day. It could be some action the user just initiated. It could be problems with an integration point. Literally, anything.

The container is designed to be able to either collect these as you go, to be made aware (or, in the near future, to automatically &quot;become&quot; aware on its own). 

This could easily be ignorance on my part, but in the scenario you posted, it seems like these concepts must exist within the StructureMap container already for you to be able to use it? That is to say, you have to be able to resolve a &quot;dependency&quot;, which really isn&#039;t a dependency, and likely not anything you even want inject/resolve anywhere. Is that correct?

I did a quick spot check on the googles for StructureMap, ConditionallyUse and IContext. Nothing really stood out to me that defined it well enough for me to get a good grasp of how it works.

Really, for me, it comes down to divorcing the concept of context and where it comes from away from types that can be injected. The container absolutely should be aware of context. But I don&#039;t want to make users register the ModelBinding class unless they actually plan to make it a dependency of some type, or resolve it for their application need.

I&#039;d much rather give the container pieces of information as I go, or give the ability to find information on its own as it goes. Creating an object just so that I can register it, just so the container can look it up as a rule... seems kinda like a workaround, to me. In fact, I could do the same exact thing with Siege during registration. But that doesn&#039;t really do what I was trying to do.

I guess ultimately what I&#039;m saying is … how would you express something like this?

Let&#039;s assume the following types:

interface IAccountService
class WellFundedAccountService
class OverdrawnAccountService
class SystemUnavailableAccountService

I&#039;m a customer of a bank. When I log in to their website, the system requests an IAccountService implementation. Based on whether or not the current customer&#039;s account is overdrawn or not, I want to either get WellFundedAccountService or an OverdrawnAccountService. Additionally, if the last request to get a user&#039;s account (same or different user session) failed, I want to show a SystemUnavailableAccountService (I want this rule to be true for 5 minutes, and we&#039;ll ignore any concurrency issues).

I know it&#039;s a contrived scenario, and disconnected from the original example in this post, but I think it demonstrates the difference. These things are purely derived from arbitrary information. I could make the example completely more arbitrary than this.  These are the sorts of things I want to be able to support.

Again, it may be my ignorance in this matter, but it doesn&#039;t seem like StructureMap natively supports this level of complete arbitrariness.

For completeness sake, here&#039;s how we would do it in Siege:

locator
	.Register(Given&lt;IAccountService&gt;.When&lt;User&gt;(user=&gt; user.Account.Balance &gt;= 0).Then&lt;WellFundedAccountService&gt;())
	.Register(Given&lt;IAccountService&gt;.When&lt;User&gt;(user =&gt; user.Account.Balance &lt; 0).Then&lt;OverdrawnAccountService&gt;())
	.Register(Given&lt;IAccountService&gt;.When&lt;SystemStatus&gt;(status =&gt; status == status.IsOffline).Then&lt;SystemUnavailableAccountService());


From here, there&#039;s a couple of ways to do it. I&#039;ll approach this with &quot;non-awareness&quot; to show another side of it.

On log in, after current user has been determined:

locator.AddContext(currentUser);

Now all the information is available for the first two rules (well funded versus overdrawn). Additionally, we could have made the rules based on Account instead of user and passed that as context instead. But, I digress.

On your account accessor page (or whatever mechanism used to view your account), assume you got a system failure of some sort for a different user.

try
{
	//access your account, assume at this point IAccountService is a WellFundedAccountService
}
catch(Exception)
{
	locator.AddContext(new SystemStatus { IsOffline = true, MinutesUntilOnline = 5 });
//assume internally that after the timer it resets to IsOffline = false
}

Again, I would say that this is all achievable with Awareness as well. But I want to show how context is accumulated throughout an application separate from the point of registration. The question I think is -- if you were to use StructureMap&#039;s approach, how many types would you have to create, and register, and get instance to and update as you go?

I&#039;d be curious to know. I don&#039;t know StructureMap super-well. And if, great! I think this is a better use of containers than a 1:1 interface-to-type decoupling. 

Sorry for the blog-within-a-blog, I guess I&#039;m just long-winded. :)</description>
		<content:encoded><![CDATA[<p>Hi Robin,</p>
<p>I would say &#8220;not exactly&#8221;. The core distinction between how I&#8217;m doing this and how StructureMap is doing this is that I would say my stuff is more adaptive.</p>
<p>Awareness is just one way the container is able to understand what you want to do. My goal is to decouple what can be considered context and where it comes from away from making the container the end-all, be-all for determining what context &#8220;is&#8221;.</p>
<p>For Siege, context can be &#8230; anything. It can be information about the current user. It could be the time of day. It could be some action the user just initiated. It could be problems with an integration point. Literally, anything.</p>
<p>The container is designed to be able to either collect these as you go, to be made aware (or, in the near future, to automatically &#8220;become&#8221; aware on its own). </p>
<p>This could easily be ignorance on my part, but in the scenario you posted, it seems like these concepts must exist within the StructureMap container already for you to be able to use it? That is to say, you have to be able to resolve a &#8220;dependency&#8221;, which really isn&#8217;t a dependency, and likely not anything you even want inject/resolve anywhere. Is that correct?</p>
<p>I did a quick spot check on the googles for StructureMap, ConditionallyUse and IContext. Nothing really stood out to me that defined it well enough for me to get a good grasp of how it works.</p>
<p>Really, for me, it comes down to divorcing the concept of context and where it comes from away from types that can be injected. The container absolutely should be aware of context. But I don&#8217;t want to make users register the ModelBinding class unless they actually plan to make it a dependency of some type, or resolve it for their application need.</p>
<p>I&#8217;d much rather give the container pieces of information as I go, or give the ability to find information on its own as it goes. Creating an object just so that I can register it, just so the container can look it up as a rule&#8230; seems kinda like a workaround, to me. In fact, I could do the same exact thing with Siege during registration. But that doesn&#8217;t really do what I was trying to do.</p>
<p>I guess ultimately what I&#8217;m saying is … how would you express something like this?</p>
<p>Let&#8217;s assume the following types:</p>
<p>interface IAccountService<br />
class WellFundedAccountService<br />
class OverdrawnAccountService<br />
class SystemUnavailableAccountService</p>
<p>I&#8217;m a customer of a bank. When I log in to their website, the system requests an IAccountService implementation. Based on whether or not the current customer&#8217;s account is overdrawn or not, I want to either get WellFundedAccountService or an OverdrawnAccountService. Additionally, if the last request to get a user&#8217;s account (same or different user session) failed, I want to show a SystemUnavailableAccountService (I want this rule to be true for 5 minutes, and we&#8217;ll ignore any concurrency issues).</p>
<p>I know it&#8217;s a contrived scenario, and disconnected from the original example in this post, but I think it demonstrates the difference. These things are purely derived from arbitrary information. I could make the example completely more arbitrary than this.  These are the sorts of things I want to be able to support.</p>
<p>Again, it may be my ignorance in this matter, but it doesn&#8217;t seem like StructureMap natively supports this level of complete arbitrariness.</p>
<p>For completeness sake, here&#8217;s how we would do it in Siege:</p>
<p>locator<br />
	.Register(Given<iaccountservice>.When<user>(user=> user.Account.Balance >= 0).Then<wellfundedaccountservice>())<br />
	.Register(Given<iaccountservice>.When<user>(user => user.Account.Balance < 0).Then<OverdrawnAccountService>())<br />
	.Register(Given<iaccountservice>.When<systemstatus>(status => status == status.IsOffline).Then<systemunavailableaccountservice ());</p>
<p>From here, there&#8217;s a couple of ways to do it. I&#8217;ll approach this with &#8220;non-awareness&#8221; to show another side of it.</p>
<p>On log in, after current user has been determined:</p>
<p>locator.AddContext(currentUser);</p>
<p>Now all the information is available for the first two rules (well funded versus overdrawn). Additionally, we could have made the rules based on Account instead of user and passed that as context instead. But, I digress.</p>
<p>On your account accessor page (or whatever mechanism used to view your account), assume you got a system failure of some sort for a different user.</p>
<p>try<br />
{<br />
	//access your account, assume at this point IAccountService is a WellFundedAccountService<br />
}<br />
catch(Exception)<br />
{<br />
	locator.AddContext(new SystemStatus { IsOffline = true, MinutesUntilOnline = 5 });<br />
//assume internally that after the timer it resets to IsOffline = false<br />
}</p>
<p>Again, I would say that this is all achievable with Awareness as well. But I want to show how context is accumulated throughout an application separate from the point of registration. The question I think is &#8212; if you were to use StructureMap&#8217;s approach, how many types would you have to create, and register, and get instance to and update as you go?</p>
<p>I&#8217;d be curious to know. I don&#8217;t know StructureMap super-well. And if, great! I think this is a better use of containers than a 1:1 interface-to-type decoupling. </p>
<p>Sorry for the blog-within-a-blog, I guess I&#8217;m just long-winded. <img src='http://lostechies.com/marcusbratton/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </systemstatus></iaccountservice></user></iaccountservice></wellfundedaccountservice></user></iaccountservice></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Clowers</title>
		<link>http://lostechies.com/marcusbratton/2010/09/17/contextual-awareness-making-your-container-behave-intelligently/#comment-71</link>
		<dc:creator>Robin Clowers</dc:creator>
		<pubDate>Fri, 17 Sep 2010 18:08:07 +0000</pubDate>
		<guid isPermaLink="false">/blogs/marcus_bratton/archive/2010/09/17/contextual-awareness-making-your-container-behave-intelligently.aspx#comment-71</guid>
		<description>Actually you can do conditional registration, although you would need to register your own object that accesses the model binder on each request get what siege is providing:

            var container = new Container(x =&gt; 
                x.For&lt;IExampleService&gt;().ConditionallyUse(c =&gt;
                {
                    c.If(context =&gt; context.GetInstance&lt;ModelBinding&gt;().For&lt;SelectionType&gt;() == SelectionType.OptionA).ThenIt.Is.Type&lt;OptionAService&gt;();
                    c.If(context =&gt; context.GetInstance&lt;ModelBinding&gt;().For&lt;SelectionType&gt;() == SelectionType.OptionB).ThenIt.Is.Type&lt;OptionBService&gt;();
                }));</description>
		<content:encoded><![CDATA[<p>Actually you can do conditional registration, although you would need to register your own object that accesses the model binder on each request get what siege is providing:</p>
<p>            var container = new Container(x =><br />
                x.For<iexampleservice>().ConditionallyUse(c =><br />
                {<br />
                    c.If(context => context.GetInstance<modelbinding>().For<br />
<selectiontype>() == SelectionType.OptionA).ThenIt.Is.Type<br />
<optionaservice>();<br />
                    c.If(context => context.GetInstance<modelbinding>().For<br />
<selectiontype>() == SelectionType.OptionB).ThenIt.Is.Type<br />
<optionbservice>();<br />
                }));</optionbservice></selectiontype></modelbinding></optionaservice></selectiontype></modelbinding></iexampleservice></p>
]]></content:encoded>
	</item>
</channel>
</rss>
