<?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: Why You Shouldn&#8217;t Expose Your Entities Through Your Services</title> <atom:link href="http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/feed/" rel="self" type="application/rss+xml" /><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/</link> <description>inquisitive: adjective. given to inquiry, research, or asking questions; eager for knowledge; intellectually curious</description> <lastBuildDate>Tue, 22 May 2012 17:40:00 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: DTO&#8217;s Should Transfer Data, Not Entities</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-104732</link> <dc:creator>DTO&#8217;s Should Transfer Data, Not Entities</dc:creator> <pubDate>Sun, 19 Feb 2012 19:32:21 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-104732</guid> <description>[...] making those entities available outside of the service boundary for reasons that I&#039;ve discussed earlier. That doesn&#039;t mean that you should go the entity-mimicking-DTO-route though. In fact, [...]</description> <content:encoded><![CDATA[<p>[...] making those entities available outside of the service boundary for reasons that I&#039;ve discussed earlier. That doesn&#039;t mean that you should go the entity-mimicking-DTO-route though. In fact, [...]</p> ]]></content:encoded> </item> <item><title>By: Learning Silverlight #3 &#8211; Getting Started &#171; Danny-T.co.uk home of Dan Thomas, Moov2 Ltd</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-97570</link> <dc:creator>Learning Silverlight #3 &#8211; Getting Started &#171; Danny-T.co.uk home of Dan Thomas, Moov2 Ltd</dc:creator> <pubDate>Sat, 12 Feb 2011 22:04:50 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-97570</guid> <description>[...] a poor experience. The whole discussion is worthy of it&#8217;s own post, fortunately someone has done that for [...]</description> <content:encoded><![CDATA[<p>[...] a poor experience. The whole discussion is worthy of it&#8217;s own post, fortunately someone has done that for [...]</p> ]]></content:encoded> </item> <item><title>By: Haipeng Jiang</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-84450</link> <dc:creator>Haipeng Jiang</dc:creator> <pubDate>Wed, 22 Dec 2010 02:54:21 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-84450</guid> <description>Could anyone please advise me on this design of a data integration solution:We&#039;re doing a data integration project between a MS Sql Server database and a Microsoft CRM system (through its web services).We&#039;re trying to build a &quot;service&quot; layer on top of the database. The design of our current solution is to use web services for CRUD, with xml being the format of data.Views are created to consolidate related tables into one entity, and we query these views, using the &quot;SELECT * FROM someview &quot; + &quot;For XML&quot; to generated xml that will be returned from our web services.For update we&#039;re trying to use the same approach - using SQL XML to map updates views, we have &quot;instead of&quot; triggers defined on top of these views, and in these &quot;instead of&quot; triggers we update the underlying tables.The views/triggers are generated by tools so don&#039;t be too concerned with coding efficiency here...what do you think if we use WCF data Provider to publish a enterprise data model (essentially DTOs) ? p.s., we don&#039;t have a BL layer for now, it&#039;s all in the stored procedures!!!What&#039;s your opinion on this / any better design? much appreciated!</description> <content:encoded><![CDATA[<p>Could anyone please advise me on this design of a data integration solution:</p><p>We&#8217;re doing a data integration project between a MS Sql Server database and a Microsoft CRM system (through its web services).</p><p>We&#8217;re trying to build a &#8220;service&#8221; layer on top of the database. The design of our current solution is to use web services for CRUD, with xml being the format of data.</p><p>Views are created to consolidate related tables into one entity, and we query these views, using the &#8220;SELECT * FROM someview &#8221; + &#8220;For XML&#8221; to generated xml that will be returned from our web services.</p><p>For update we&#8217;re trying to use the same approach &#8211; using SQL XML to map updates views, we have &#8220;instead of&#8221; triggers defined on top of these views, and in these &#8220;instead of&#8221; triggers we update the underlying tables.</p><p>The views/triggers are generated by tools so don&#8217;t be too concerned with coding efficiency here&#8230;</p><p>what do you think if we use WCF data Provider to publish a enterprise data model (essentially DTOs) ? p.s., we don&#8217;t have a BL layer for now, it&#8217;s all in the stored procedures!!!</p><p>What&#8217;s your opinion on this / any better design? much appreciated!</p> ]]></content:encoded> </item> <item><title>By: Datta Jadhav</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-62615</link> <dc:creator>Datta Jadhav</dc:creator> <pubDate>Sat, 02 Oct 2010 07:28:42 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-62615</guid> <description>thanks for really great post.i agree with u.</description> <content:encoded><![CDATA[<p>thanks for really great post.</p><p>i agree with u.</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-49949</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Thu, 29 Jul 2010 13:14:19 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-49949</guid> <description>@AmineRIA Services doesn&#039;t change my opinion about this at all. The more you share between client and server, the worse off you&#039;ll be. It&#039;s really as simple as that.And yes, it could lead to a lot of DTO&#039;s. And yes, you have to write them by hand. People quickly say that it&#039;s a lot of work, but seriously, if that takes up too much of your time than you&#039;ve got bigger problems to worry about. And yes, you can have multiple DTO types which essentially all &#039;show&#039; data from the same entity, but in different ways. But they all will be used in the most optimal manner... the one-size-fits-all approach simply doesn&#039;t hold up for long.As for the ResultTransformer... you can use projections in your NHibernate Criterias and then let NHibernate hydrate your DTOs directly through the ResultTransformer, based on the projections.  A quick google search should tell you more.</description> <content:encoded><![CDATA[<p>@Amine</p><p>RIA Services doesn&#8217;t change my opinion about this at all. The more you share between client and server, the worse off you&#8217;ll be. It&#8217;s really as simple as that.</p><p>And yes, it could lead to a lot of DTO&#8217;s. And yes, you have to write them by hand. People quickly say that it&#8217;s a lot of work, but seriously, if that takes up too much of your time than you&#8217;ve got bigger problems to worry about. And yes, you can have multiple DTO types which essentially all &#8216;show&#8217; data from the same entity, but in different ways. But they all will be used in the most optimal manner&#8230; the one-size-fits-all approach simply doesn&#8217;t hold up for long.</p><p>As for the ResultTransformer&#8230; you can use projections in your NHibernate Criterias and then let NHibernate hydrate your DTOs directly through the ResultTransformer, based on the projections.  A quick google search should tell you more.</p> ]]></content:encoded> </item> <item><title>By: Amine</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-49946</link> <dc:creator>Amine</dc:creator> <pubDate>Thu, 29 Jul 2010 13:01:03 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-49946</guid> <description>Hi All,
Thanks Davy, greate Post.
But I am wondering if all that was sayed here still true after the release of WCF Ria Services. surely the problem of Domain Changes still exist, but concerning data validation, WCF Ria Services, is offering a good way to share the validation logic between client and server, on top of DataAnnotations. Is there any one how agrees with me on that, and if yes, is that a personnal opinon or a result of real word experience.
a second question : If I will try to apply what was sayed here, I will have to develop many of DTOs by Hand. suppose that in cases i am requiring a ConsumerDTO with only 2 fileds (lets say ID and Name for example) and later I am requiring ConsumerDTO1 with 5 fields to be showed and / or modified by end User, and later a third ConsumerDTO2 .... and so on...  I know that with a little copy&amp;paste it can be resolved, but i am not very convienced that this is the best way.
Third and final Question : Still have not a clear idea about ResultTransformer mentioned with NHibernate. is there any further clarification ???Thanks in advance .</description> <content:encoded><![CDATA[<p>Hi All,<br
/> Thanks Davy, greate Post.<br
/> But I am wondering if all that was sayed here still true after the release of WCF Ria Services. surely the problem of Domain Changes still exist, but concerning data validation, WCF Ria Services, is offering a good way to share the validation logic between client and server, on top of DataAnnotations. Is there any one how agrees with me on that, and if yes, is that a personnal opinon or a result of real word experience.<br
/> a second question : If I will try to apply what was sayed here, I will have to develop many of DTOs by Hand. suppose that in cases i am requiring a ConsumerDTO with only 2 fileds (lets say ID and Name for example) and later I am requiring ConsumerDTO1 with 5 fields to be showed and / or modified by end User, and later a third ConsumerDTO2 &#8230;. and so on&#8230;  I know that with a little copy&amp;paste it can be resolved, but i am not very convienced that this is the best way.<br
/> Third and final Question : Still have not a clear idea about ResultTransformer mentioned with NHibernate. is there any further clarification ???</p><p>Thanks in advance .</p> ]]></content:encoded> </item> <item><title>By: AjarnMark</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-48013</link> <dc:creator>AjarnMark</dc:creator> <pubDate>Mon, 19 Jul 2010 17:14:12 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-48013</guid> <description>Davy, thanks for this post!  This clears up some confusion I was having while studying examples of Entity Framework in action.  We&#039;ve been writing most of the plumbing code by hand in our systems for a while, and I have been reviewing O/R options recently, but have felt that there was something just not quite &quot;right&quot; with the examples, even though they worked.  It seems what my gut was telling me is the same thing your post highlights and that David Martines alludes to: the examples are overly simplified to illustrate a particular feature, and do not reflect best practices.  After reading several of your articles and a few by Craig Stuntz as well, I am much more comfortable with blending the good parts of our existing approach with the benefits that an O/R Mapper brings to the equation.  Keep up the good fight (and great writing)!</description> <content:encoded><![CDATA[<p>Davy, thanks for this post!  This clears up some confusion I was having while studying examples of Entity Framework in action.  We&#8217;ve been writing most of the plumbing code by hand in our systems for a while, and I have been reviewing O/R options recently, but have felt that there was something just not quite &#8220;right&#8221; with the examples, even though they worked.  It seems what my gut was telling me is the same thing your post highlights and that David Martines alludes to: the examples are overly simplified to illustrate a particular feature, and do not reflect best practices.  After reading several of your articles and a few by Craig Stuntz as well, I am much more comfortable with blending the good parts of our existing approach with the benefits that an O/R Mapper brings to the equation.  Keep up the good fight (and great writing)!</p> ]]></content:encoded> </item> <item><title>By: Lars-Erik Roald</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-47395</link> <dc:creator>Lars-Erik Roald</dc:creator> <pubDate>Fri, 16 Jul 2010 09:33:21 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-47395</guid> <description>I know I am bit late for commenting this blogpost...but I totally agree with you. Exposing the backend entities to the client is a dangerous game. I have done this myself in a pretty large project (wcf ria services) - it was a disaster. The layers will be transparent - a change in the db will cause a change in all the clients. And exposing an iqueryable interface against the entities at the clientside is not good - specifications , not depending on entities, are much better.
What surprises me, is that developers tend to fall into this pitfall again and again - even experienced developers. And Microsoft helps us falling...by introduciing odata, wcf ria...</description> <content:encoded><![CDATA[<p>I know I am bit late for commenting this blogpost&#8230;but I totally agree with you. Exposing the backend entities to the client is a dangerous game. I have done this myself in a pretty large project (wcf ria services) &#8211; it was a disaster. The layers will be transparent &#8211; a change in the db will cause a change in all the clients. And exposing an iqueryable interface against the entities at the clientside is not good &#8211; specifications , not depending on entities, are much better.<br
/> What surprises me, is that developers tend to fall into this pitfall again and again &#8211; even experienced developers. And Microsoft helps us falling&#8230;by introduciing odata, wcf ria&#8230;</p> ]]></content:encoded> </item> <item><title>By: links for 2010-07-15 &#171; Praveen&#8217;s Blog</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-47305</link> <dc:creator>links for 2010-07-15 &#171; Praveen&#8217;s Blog</dc:creator> <pubDate>Fri, 16 Jul 2010 00:02:26 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-47305</guid> <description>[...] Why You Shouldn’t Expose Your Entities Through Your Services &#124; The Inquisitive Coder – Davy Brio... (tags: ddd wcf architecture programming service bestpractices blog c# dto arquitectura) [...]</description> <content:encoded><![CDATA[<p>[...] Why You Shouldn’t Expose Your Entities Through Your Services | The Inquisitive Coder – Davy Brio&#8230; (tags: ddd wcf architecture programming service bestpractices blog c# dto arquitectura) [...]</p> ]]></content:encoded> </item> <item><title>By: More Debugging Tips - Peter Miller</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-42897</link> <dc:creator>More Debugging Tips - Peter Miller</dc:creator> <pubDate>Thu, 24 Jun 2010 02:50:58 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-42897</guid> <description>[...] our design, particularly our WCF data objects. For more on this topic see this wonderful blog post: http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/  Posted: Jun 23 2010, 05:50 PM by pmiller &#124; with no [...]</description> <content:encoded><![CDATA[<p>[...] our design, particularly our WCF data objects. For more on this topic see this wonderful blog post: <a
href="http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/" rel="nofollow">http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/</a> Posted: Jun 23 2010, 05:50 PM by pmiller | with no [...]</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-40823</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Tue, 01 Jun 2010 08:16:01 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-40823</guid> <description>@Dhananjaymy only requirement is basically that databinding can _never_ trigger an automatic service call or database roundtrip... that&#039;s pretty much it as far as i care about it</description> <content:encoded><![CDATA[<p>@Dhananjay</p><p>my only requirement is basically that databinding can _never_ trigger an automatic service call or database roundtrip&#8230; that&#8217;s pretty much it as far as i care about it</p> ]]></content:encoded> </item> <item><title>By: Dhananjay Goyani</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-40814</link> <dc:creator>Dhananjay Goyani</dc:creator> <pubDate>Tue, 01 Jun 2010 04:51:10 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-40814</guid> <description>And also, I am wondering what kind of data binding approach you prefer? Both for Silverlight and MVC apps.</description> <content:encoded><![CDATA[<p>And also, I am wondering what kind of data binding approach you prefer? Both for Silverlight and MVC apps.</p> ]]></content:encoded> </item> <item><title>By: Scott Banwart&#39;s Blog &#187; Blog Archive &#187; Distributed 52</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-40507</link> <dc:creator>Scott Banwart&#39;s Blog &#187; Blog Archive &#187; Distributed 52</dc:creator> <pubDate>Fri, 28 May 2010 15:12:07 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-40507</guid> <description>[...] Why You Shouldn’t Expose Your Entities Through Your Services [...]</description> <content:encoded><![CDATA[<p>[...] Why You Shouldn’t Expose Your Entities Through Your Services [...]</p> ]]></content:encoded> </item> <item><title>By: Dhananjay Goyani</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-40037</link> <dc:creator>Dhananjay Goyani</dc:creator> <pubDate>Mon, 24 May 2010 06:43:02 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-40037</guid> <description>well, yah I got your point.</description> <content:encoded><![CDATA[<p>well, yah I got your point.</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-39796</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Fri, 21 May 2010 12:56:43 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-39796</guid> <description>We don&#039;t use MVVM so i&#039;m probably a bit rusty when it comes to the details of a ViewModel, but i wouldn&#039;t consider them related at all.You&#039;d probably use the data from the DTO&#039;s, or even the DTO&#039;s themselve in the ViewModel but a ViewModel itself is in no way a DTO IMHO</description> <content:encoded><![CDATA[<p>We don&#8217;t use MVVM so i&#8217;m probably a bit rusty when it comes to the details of a ViewModel, but i wouldn&#8217;t consider them related at all.</p><p>You&#8217;d probably use the data from the DTO&#8217;s, or even the DTO&#8217;s themselve in the ViewModel but a ViewModel itself is in no way a DTO IMHO</p> ]]></content:encoded> </item> <item><title>By: Dhananjay Goyani</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-39795</link> <dc:creator>Dhananjay Goyani</dc:creator> <pubDate>Fri, 21 May 2010 12:53:01 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-39795</guid> <description>Is ViewModel (the MVVM pattern) specialized case of DTO? Just want to know your view.</description> <content:encoded><![CDATA[<p>Is ViewModel (the MVVM pattern) specialized case of DTO? Just want to know your view.</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-39627</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Wed, 19 May 2010 08:26:14 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-39627</guid> <description>@Henningyeah, we occasionally map views with NHibernate as well and in some cases even use stored procedures for really complex queries</description> <content:encoded><![CDATA[<p>@Henning</p><p>yeah, we occasionally map views with NHibernate as well and in some cases even use stored procedures for really complex queries</p> ]]></content:encoded> </item> <item><title>By: Henning Anderssen</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-39625</link> <dc:creator>Henning Anderssen</dc:creator> <pubDate>Wed, 19 May 2010 07:55:13 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-39625</guid> <description>@DavyWe actually considered doing something like you mention, where we create NHibernate mappings directly to the view models, but because of various reasons we chose to change our domain model a bit and denormalize some of the data. Not sure what the effect was, since I&#039;m not working on that part of the system at the moment. We also discussed persistent viewmodels, or rather persisten reportmodels, since it is our big reports that eat up most of the resources. The app is quite reporting heavy.If one choses to use some kind of persistent viewmodels, you could do the updates to the viewmodels async, so they&#039;ll be eventually consistent. I guess more in line with the whole CQRS thinking. Depends on your needs I guess.Btw, I&#039;d also chose read performance in most of my apps any day of the week. However, some apps will be more read heavy, and such a solution would not be as effective.</description> <content:encoded><![CDATA[<p>@Davy</p><p>We actually considered doing something like you mention, where we create NHibernate mappings directly to the view models, but because of various reasons we chose to change our domain model a bit and denormalize some of the data. Not sure what the effect was, since I&#8217;m not working on that part of the system at the moment. We also discussed persistent viewmodels, or rather persisten reportmodels, since it is our big reports that eat up most of the resources. The app is quite reporting heavy.</p><p>If one choses to use some kind of persistent viewmodels, you could do the updates to the viewmodels async, so they&#8217;ll be eventually consistent. I guess more in line with the whole CQRS thinking. Depends on your needs I guess.</p><p>Btw, I&#8217;d also chose read performance in most of my apps any day of the week. However, some apps will be more read heavy, and such a solution would not be as effective.</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-39622</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Wed, 19 May 2010 07:09:23 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-39622</guid> <description>@Dan Jensen&quot;Would you go ahead and duplicate the rules on the front end? Or maybe create some sort of helper class that performs the calcs, which both the VMs and entities could call? In most cases I also need to validate the numbers before persisting them, and it would essentially be using the same formula to make sure the numbers are correct.&quot;sort of depends on the actual calculation... if it&#039;s a very easy one or one that is highly unlikely to ever change, i&#039;d just duplicate it to be honest. sure, some people would call me heretic for that but a little bit of pragmatism never hurt anybody.  If it&#039;s a tough calculation, i&#039;d either go with the helper class, or just making it a server-side only thing. You could trigger the request to calculate the value asynchronously when the user inputs both required fields and then just update the calculated value when the result is retrieved.  then you can reuse the same logic when you&#039;re performing your final server-side validation as well.@Henningi&#039;d rather not sacrifice read-performance... people&#039;s impression of a system&#039;s responsiveness is largely based on read-performance. That writes are a bit slower than reads is somewhat more easily acceptable to them &quot;because the system is working!&quot; other than &quot;it&#039;s just supposed to show me data!&quot; during reads</description> <content:encoded><![CDATA[<p>@Dan Jensen</p><p>&#8220;Would you go ahead and duplicate the rules on the front end? Or maybe create some sort of helper class that performs the calcs, which both the VMs and entities could call? In most cases I also need to validate the numbers before persisting them, and it would essentially be using the same formula to make sure the numbers are correct.&#8221;</p><p>sort of depends on the actual calculation&#8230; if it&#8217;s a very easy one or one that is highly unlikely to ever change, i&#8217;d just duplicate it to be honest. sure, some people would call me heretic for that but a little bit of pragmatism never hurt anybody.  If it&#8217;s a tough calculation, i&#8217;d either go with the helper class, or just making it a server-side only thing. You could trigger the request to calculate the value asynchronously when the user inputs both required fields and then just update the calculated value when the result is retrieved.  then you can reuse the same logic when you&#8217;re performing your final server-side validation as well.</p><p>@Henning</p><p>i&#8217;d rather not sacrifice read-performance&#8230; people&#8217;s impression of a system&#8217;s responsiveness is largely based on read-performance. That writes are a bit slower than reads is somewhat more easily acceptable to them &#8220;because the system is working!&#8221; other than &#8220;it&#8217;s just supposed to show me data!&#8221; during reads</p> ]]></content:encoded> </item> <item><title>By: Henning Anderssen</title><link>http://davybrion.com/blog/2010/05/why-you-shouldnt-expose-your-entities-through-your-services/comment-page-1/#comment-39620</link> <dc:creator>Henning Anderssen</dc:creator> <pubDate>Wed, 19 May 2010 06:18:58 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2318#comment-39620</guid> <description>Good post and couldn&#039;t agree more. I have one comment though, on the part where you mention projecting the raw data to your DTO&#039;s or whatever. When you do it like that, you/ORM still have to do all the nasty SQL junk, such as join and what not.
Perhaps it would be better to actually save the DTO&#039;s to the database. That particular method is called Persistent View models by either Udi Dahan or Greg Young.  That might give you some extra overhead when changing names or other modifications, where you have to now update many other tables and rows, etc, but do you really want to sacrifice read performance for that (probably highly) rare update?@Dan Jensen,
In that case you&#039;d want to extract the calculation into a &quot;Domain service&quot; and inject the calculation class into your entity via Double Dispatch, and into your MVC controller (or whatever else you use). Remember to use interfaces when injecting and not the actual implementation of the calculation!!</description> <content:encoded><![CDATA[<p>Good post and couldn&#8217;t agree more. I have one comment though, on the part where you mention projecting the raw data to your DTO&#8217;s or whatever. When you do it like that, you/ORM still have to do all the nasty SQL junk, such as join and what not.<br
/> Perhaps it would be better to actually save the DTO&#8217;s to the database. That particular method is called Persistent View models by either Udi Dahan or Greg Young.  That might give you some extra overhead when changing names or other modifications, where you have to now update many other tables and rows, etc, but do you really want to sacrifice read performance for that (probably highly) rare update?</p><p>@Dan Jensen,<br
/> In that case you&#8217;d want to extract the calculation into a &#8220;Domain service&#8221; and inject the calculation class into your entity via Double Dispatch, and into your MVC controller (or whatever else you use). Remember to use interfaces when injecting and not the actual implementation of the calculation!!</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/24 queries in 0.016 seconds using disk: basic
Object Caching 640/641 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d18sni7re4ly7f.cloudfront.net

Served from: davybrion.com @ 2012-05-23 03:08:33 -->
