<?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: Better Domain-Driven Design Implementation</title>
	<atom:link href="http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Sun, 14 Mar 2010 06:27:00 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-36268</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Thu, 25 Jun 2009 11:41:06 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-36268</guid>
		<description>Dario-g,

Injecting services into domain model objects tends to complicate things more in the long run.  Same goes for repositories.

Thanks.</description>
		<content:encoded><![CDATA[<p>Dario-g,</p>
<p>Injecting services into domain model objects tends to complicate things more in the long run.  Same goes for repositories.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dario-g</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-36262</link>
		<dc:creator>dario-g</dc:creator>
		<pubDate>Tue, 23 Jun 2009 21:26:20 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-36262</guid>
		<description>What about that solution?

public class Order
{
       public virtual Money CalculateCost(IOrderCostCalcService srv)
       {
              Money cost = Money.Zero;
              foreach (OrderLine line in srv.GetOrderLinesForCalcCost(this.ID))
                     cost = cost.Add(line.Cost);   
              cost = cost.Add(this.ShippingCosts);
              return ApplyTaxes(cost);
       }
}</description>
		<content:encoded><![CDATA[<p>What about that solution?</p>
<p>public class Order<br />
{<br />
       public virtual Money CalculateCost(IOrderCostCalcService srv)<br />
       {<br />
              Money cost = Money.Zero;<br />
              foreach (OrderLine line in srv.GetOrderLinesForCalcCost(this.ID))<br />
                     cost = cost.Add(line.Cost);<br />
              cost = cost.Add(this.ShippingCosts);<br />
              return ApplyTaxes(cost);<br />
       }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Domain Driven Design and Persistance Ignorance: Optimizing fetching strategy based on Unit Of Work &#171; Mr. Rask</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-36259</link>
		<dc:creator>Domain Driven Design and Persistance Ignorance: Optimizing fetching strategy based on Unit Of Work &#171; Mr. Rask</dc:creator>
		<pubDate>Mon, 22 Jun 2009 09:46:41 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-36259</guid>
		<description>[...] Dahan in response to the post by Ayende suggests introducing interfaces on the domain objects that can be used to determine [...]</description>
		<content:encoded><![CDATA[<p>[...] Dahan in response to the post by Ayende suggests introducing interfaces on the domain objects that can be used to determine [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Living in the Tech Avalanche Generation &#187; Entity Framework, Repositories, Specifications and Fetching Strategies Part 9.0</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-36041</link>
		<dc:creator>Living in the Tech Avalanche Generation &#187; Entity Framework, Repositories, Specifications and Fetching Strategies Part 9.0</dc:creator>
		<pubDate>Mon, 23 Feb 2009 09:12:17 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-36041</guid>
		<description>[...] A well rounded loading story (both eager and lazy), is critical in making the right performance choices when it comes time to writing the business logic that you know will end up causing persistence and my favoured approach to this is a highly configurable an tunable one. Udi demonstrates this using NHibernate and Fetching Strategies. [...]</description>
		<content:encoded><![CDATA[<p>[...] A well rounded loading story (both eager and lazy), is critical in making the right performance choices when it comes time to writing the business logic that you know will end up causing persistence and my favoured approach to this is a highly configurable an tunable one. Udi demonstrates this using NHibernate and Fetching Strategies. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: What purpose does the Repository Pattern have? &#171; Cav&#8217;s Weblog</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-35768</link>
		<dc:creator>What purpose does the Repository Pattern have? &#171; Cav&#8217;s Weblog</dc:creator>
		<pubDate>Wed, 22 Oct 2008 19:42:52 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-35768</guid>
		<description>[...] in my repositories to implement fetching strategies (using technique similar to the one suggested here), so specific entities can be pre-fetched where required. This allows me to optimise my data [...]</description>
		<content:encoded><![CDATA[<p>[...] in my repositories to implement fetching strategies (using technique similar to the one suggested here), so specific entities can be pre-fetched where required. This allows me to optimise my data [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-34044</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Thu, 09 Oct 2008 14:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-34044</guid>
		<description>Craig,

I don&#039;t consider this an issue. If you can do everything you need by calling a single (one and only one) method on the interface which you retrieved (it&#039;s OK to pass in other objects which you retrieved or created as parameters), then you should be fine.</description>
		<content:encoded><![CDATA[<p>Craig,</p>
<p>I don&#8217;t consider this an issue. If you can do everything you need by calling a single (one and only one) method on the interface which you retrieved (it&#8217;s OK to pass in other objects which you retrieved or created as parameters), then you should be fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CraigCav</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-33912</link>
		<dc:creator>CraigCav</dc:creator>
		<pubDate>Wed, 08 Oct 2008 13:02:31 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-33912</guid>
		<description>Udi,

I&#039;m quite new to DDD and something I have recently been contemplating (and battling with) is a rule suggested in Evan&#039;s book that only Aggregate Roots can be obtained directly with database queries,  everything else must be done through traversal. 

In the example above (and in many attempts I have made to use the repository pattern with a generic repository), it seems appropriate to request an implementation of an interface that isnt the (necessarily) the implementation of your aggregate root. 

The example code requests and returns an implementation of IOrderCalculator from the repository. This may or may not be the aggregate root (order). Do you see this as an issue?</description>
		<content:encoded><![CDATA[<p>Udi,</p>
<p>I&#8217;m quite new to DDD and something I have recently been contemplating (and battling with) is a rule suggested in Evan&#8217;s book that only Aggregate Roots can be obtained directly with database queries,  everything else must be done through traversal. </p>
<p>In the example above (and in many attempts I have made to use the repository pattern with a generic repository), it seems appropriate to request an implementation of an interface that isnt the (necessarily) the implementation of your aggregate root. </p>
<p>The example code requests and returns an implementation of IOrderCalculator from the repository. This may or may not be the aggregate root (order). Do you see this as an issue?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elegant Code &#187; Properties - A False Sense of Encapsulation</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-32791</link>
		<dc:creator>Elegant Code &#187; Properties - A False Sense of Encapsulation</dc:creator>
		<pubDate>Fri, 26 Sep 2008 23:11:21 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-32791</guid>
		<description>[...] role interfaces described by Martin Fowler and popularized by Udi Dahan can provide a clean solution here. A domain object that implements two types of [...]</description>
		<content:encoded><![CDATA[<p>[...] role interfaces described by Martin Fowler and popularized by Udi Dahan can provide a clean solution here. A domain object that implements two types of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anders Norås' Blog : Generics, Inversion of Control and Repository&#38;lt;T&#38;gt;</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-19994</link>
		<dc:creator>Anders Norås' Blog : Generics, Inversion of Control and Repository&#38;lt;T&#38;gt;</dc:creator>
		<pubDate>Thu, 03 Apr 2008 23:35:05 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-19994</guid>
		<description>[...] domain models using the patterns and design techniques Ayende and Udi have been writing quite a lot about lately. The missing piece to the puzzle is better generics support from the dependency injection [...]</description>
		<content:encoded><![CDATA[<p>[...] domain models using the patterns and design techniques Ayende and Udi have been writing quite a lot about lately. The missing piece to the puzzle is better generics support from the dependency injection [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-19850</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Thu, 27 Mar 2008 20:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-19850</guid>
		<description>Colin,

Query performance is not the primary driver. Decreasing the number of SELECT statements hitting the DB in an OLTP scenario (affecting overall throughput) is a big one - yet not the only one.

Once I have that interface, I can hook other behaviors on to it in the same fashion - IAuditor&lt;T&gt;, ISecurity&lt;T&gt;, etc. In other words, I get flexibility.</description>
		<content:encoded><![CDATA[<p>Colin,</p>
<p>Query performance is not the primary driver. Decreasing the number of SELECT statements hitting the DB in an OLTP scenario (affecting overall throughput) is a big one &#8211; yet not the only one.</p>
<p>Once I have that interface, I can hook other behaviors on to it in the same fashion &#8211; IAuditor<t>, ISecurity</t><t>, etc. In other words, I get flexibility.</t></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Jack</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-19833</link>
		<dc:creator>Colin Jack</dc:creator>
		<pubDate>Thu, 27 Mar 2008 12:55:53 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-19833</guid>
		<description>I meant the interfaces, as you say having role interfaces is a good idea (though I haven&#039;t used them much in our domain model so far) but I&#039;m just not thinking I&#039;d design role interfaces with query performance being my primary driver. Well I wouldn&#039;t for the system I work on at the moment. Also not really all that interested in decoupling my service/domain layers.

Anyway interesting stuff.</description>
		<content:encoded><![CDATA[<p>I meant the interfaces, as you say having role interfaces is a good idea (though I haven&#8217;t used them much in our domain model so far) but I&#8217;m just not thinking I&#8217;d design role interfaces with query performance being my primary driver. Well I wouldn&#8217;t for the system I work on at the moment. Also not really all that interested in decoupling my service/domain layers.</p>
<p>Anyway interesting stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thesoftwaresimplist</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-2573</link>
		<dc:creator>thesoftwaresimplist</dc:creator>
		<pubDate>Mon, 25 Jun 2007 19:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-2573</guid>
		<description>The complexity isn&#039;t in the domain - it&#039;s in the infrastructure which does the lookup, and even that&#039;s not very complex. As is shown in the follow up article (http://udidahan.weblogs.us/2007/04/23/fetching-strategy-design/) the only thing which is added to the domain are those interfaces, which, if anything, make the domain more explicit. In my example as well these additional interfaces are kept in a separate assembly, however the Service Layer interacts with that assembly and is unaware of the assembly containing the concrete classes.</description>
		<content:encoded><![CDATA[<p>The complexity isn&#8217;t in the domain &#8211; it&#8217;s in the infrastructure which does the lookup, and even that&#8217;s not very complex. As is shown in the follow up article (<a href="http://udidahan.weblogs.us/2007/04/23/fetching-strategy-design/" rel="nofollow">http://udidahan.weblogs.us/2007/04/23/fetching-strategy-design/</a>) the only thing which is added to the domain are those interfaces, which, if anything, make the domain more explicit. In my example as well these additional interfaces are kept in a separate assembly, however the Service Layer interacts with that assembly and is unaware of the assembly containing the concrete classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Jack</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-2550</link>
		<dc:creator>Colin Jack</dc:creator>
		<pubDate>Sun, 24 Jun 2007 18:51:55 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-2550</guid>
		<description>The seperation into fetching strategies seems like a good idea but  its adding a lot of complexity to the domain in the process. Having said that if you need it for performance then I guess you have to consider these sorts of options.

In actual fact we have a similiar approach to your IOrderInfo, but ours is just an OrderInfo class and its certainly not domain related at all...its even kept in a seperate Domain.Presentation assembly and doesn&#039;t get loaded by a repository.</description>
		<content:encoded><![CDATA[<p>The seperation into fetching strategies seems like a good idea but  its adding a lot of complexity to the domain in the process. Having said that if you need it for performance then I guess you have to consider these sorts of options.</p>
<p>In actual fact we have a similiar approach to your IOrderInfo, but ours is just an OrderInfo class and its certainly not domain related at all&#8230;its even kept in a seperate Domain.Presentation assembly and doesn&#8217;t get loaded by a repository.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; Performant and Explicit Domain Models</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-2152</link>
		<dc:creator>&#187; Performant and Explicit Domain Models</dc:creator>
		<pubDate>Fri, 08 Jun 2007 23:12:54 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-2152</guid>
		<description>[...] Better Domain-Driven Design Implementation - showing the basics of how valuable interfaces between your Domain Model and the Service Layer can be. [...]</description>
		<content:encoded><![CDATA[<p>[...] Better Domain-Driven Design Implementation &#8211; showing the basics of how valuable interfaces between your Domain Model and the Service Layer can be. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; Fetching Strategy Design</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-1478</link>
		<dc:creator>&#187; Fetching Strategy Design</dc:creator>
		<pubDate>Mon, 23 Apr 2007 20:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-1478</guid>
		<description>[...] up on my previous post on Better Domain-Driven Design Implementation, I wanted to show some more detail on how this actually works. There are two main concepts [...]</description>
		<content:encoded><![CDATA[<p>[...] up on my previous post on Better Domain-Driven Design Implementation, I wanted to show some more detail on how this actually works. There are two main concepts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; Query Objects vs Methods on a Repository</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-1196</link>
		<dc:creator>&#187; Query Objects vs Methods on a Repository</dc:creator>
		<pubDate>Thu, 05 Apr 2007 20:28:16 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-1196</guid>
		<description>[...] you can probably tell, I&#8217;m for option one. It also fits nicely with my fetching strategy design, which I&#8217;m going to post the detailed design for [...]</description>
		<content:encoded><![CDATA[<p>[...] you can probably tell, I&#8217;m for option one. It also fits nicely with my fetching strategy design, which I&#8217;m going to post the detailed design for [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Gielens:ThoughtsService : Aggregates, Services and Entities</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-840</link>
		<dc:creator>Paul Gielens:ThoughtsService : Aggregates, Services and Entities</dc:creator>
		<pubDate>Wed, 07 Mar 2007 10:36:46 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-840</guid>
		<description>[...] I am not so keen on the suggested alternative solution. Cluttering the domain model with different fetch strategies for specific use-case scenarios is a bad idea. I know, I have been there myself! [...]</description>
		<content:encoded><![CDATA[<p>[...] I am not so keen on the suggested alternative solution. Cluttering the domain model with different fetch strategies for specific use-case scenarios is a bad idea. I know, I have been there myself! [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thesoftwaresimplist</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-808</link>
		<dc:creator>thesoftwaresimplist</dc:creator>
		<pubDate>Tue, 06 Mar 2007 22:51:36 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-808</guid>
		<description>I&#039;ve done this a number of ways. The thing to remember is that these service layer classes still have to insert, and therefore create, concrete instances. I wrap this up in the repository, having it delegate to a dependency injection framework.

IOrder o = Repository&lt;IOrder&gt;.CreateNew();

Now to your question:

One way is to keep the interfaces as part of the model and have the concrete classes explicitly implement them - &quot;forcing&quot; developers to access them via the interface.

The second way leverages the fact that the service layer doesn&#039;t have to depend on the concrete classes at all (helped by DI). To the service layer, the interfaces are the domain model, and the concrete classes &quot;just&quot; one implementation of it. In short, two projects - one for interfaces, the second for implementation; DomainModel and DomainModel.Implementation if you will.

Finally, I don&#039;t so much view it as &quot;a place for defining extra functionality&quot; but rather the best way to express my design intent - exposing precisely what is necessary but no more - YAGNI :) Decreased coupling and the Single Responsibility Principle round it out nicely.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve done this a number of ways. The thing to remember is that these service layer classes still have to insert, and therefore create, concrete instances. I wrap this up in the repository, having it delegate to a dependency injection framework.</p>
<p>IOrder o = Repository&lt;IOrder&gt;.CreateNew();</p>
<p>Now to your question:</p>
<p>One way is to keep the interfaces as part of the model and have the concrete classes explicitly implement them &#8211; &#8220;forcing&#8221; developers to access them via the interface.</p>
<p>The second way leverages the fact that the service layer doesn&#8217;t have to depend on the concrete classes at all (helped by DI). To the service layer, the interfaces are the domain model, and the concrete classes &#8220;just&#8221; one implementation of it. In short, two projects &#8211; one for interfaces, the second for implementation; DomainModel and DomainModel.Implementation if you will.</p>
<p>Finally, I don&#8217;t so much view it as &#8220;a place for defining extra functionality&#8221; but rather the best way to express my design intent &#8211; exposing precisely what is necessary but no more &#8211; YAGNI <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Decreased coupling and the Single Responsibility Principle round it out nicely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ayende Rahien</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-796</link>
		<dc:creator>Ayende Rahien</dc:creator>
		<pubDate>Tue, 06 Mar 2007 20:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-796</guid>
		<description>How do classify IOrderCalc?
As part model or not?
A model class implements it, but it is a place for defining extra functionality.</description>
		<content:encoded><![CDATA[<p>How do classify IOrderCalc?<br />
As part model or not?<br />
A model class implements it, but it is a place for defining extra functionality.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thesoftwaresimplist</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-787</link>
		<dc:creator>thesoftwaresimplist</dc:creator>
		<pubDate>Tue, 06 Mar 2007 16:10:30 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-787</guid>
		<description>Personally, I don&#039;t like putting these sorts of persistence related attributes on my domain model.

Configuration, whether with XML or code, as long as it&#039;s separate from the domain model is what I like.</description>
		<content:encoded><![CDATA[<p>Personally, I don&#8217;t like putting these sorts of persistence related attributes on my domain model.</p>
<p>Configuration, whether with XML or code, as long as it&#8217;s separate from the domain model is what I like.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thesoftwaresimplist</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-786</link>
		<dc:creator>thesoftwaresimplist</dc:creator>
		<pubDate>Tue, 06 Mar 2007 16:06:58 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-786</guid>
		<description>Fixed:

OrderCalculator would contain a list of OrderLines, but not as IList, but rather IList&lt;IOrderLineForCalculation&gt;.</description>
		<content:encoded><![CDATA[<p>Fixed:</p>
<p>OrderCalculator would contain a list of OrderLines, but not as IList, but rather IList&lt;IOrderLineForCalculation&gt;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ayende Rahien</title>
		<link>http://www.udidahan.com/2007/03/06/better-domain-driven-design-implementation/comment-page-1/#comment-776</link>
		<dc:creator>Ayende Rahien</dc:creator>
		<pubDate>Tue, 06 Mar 2007 15:53:02 +0000</pubDate>
		<guid isPermaLink="false">http://udidahan.weblogs.us/archives/389#comment-776</guid>
		<description>Udi, for me, when I read this:

IOrderCalculator order = Repository.FindOne((Where.Order.Id == orderId));

It tells me that you have defined (probably confiugration) that when I try to load IOrderCalculator, I 
would run through an IFetchStrategy, and then load Order which in this case would get me its OrderLines as well. This means that the knowledge about this is located in the configuration, right.

I thought about doing this is with:

[RequiresFetchOf(&quot;OrderLines&quot;)]
public virtual Money CalculateCost()

But the problem is that then the service has no good way (except strings) to pass this knowledge to the repository.

So probably it would be better to put the attribute on the interface itself, and have the repository read it and invoke the appropriate fetching strategy.


&quot;OrderCalculator would contain a list of OrderLines, but not as IList, but rather IList&quot; - looks like you missed the end of the sentence.</description>
		<content:encoded><![CDATA[<p>Udi, for me, when I read this:</p>
<p>IOrderCalculator order = Repository.FindOne((Where.Order.Id == orderId));</p>
<p>It tells me that you have defined (probably confiugration) that when I try to load IOrderCalculator, I<br />
would run through an IFetchStrategy, and then load Order which in this case would get me its OrderLines as well. This means that the knowledge about this is located in the configuration, right.</p>
<p>I thought about doing this is with:</p>
<p>[RequiresFetchOf("OrderLines")]<br />
public virtual Money CalculateCost()</p>
<p>But the problem is that then the service has no good way (except strings) to pass this knowledge to the repository.</p>
<p>So probably it would be better to put the attribute on the interface itself, and have the repository read it and invoke the appropriate fetching strategy.</p>
<p>&#8220;OrderCalculator would contain a list of OrderLines, but not as IList, but rather IList&#8221; &#8211; looks like you missed the end of the sentence.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
