<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx</link><description>UPDATE: this blog post is out of date. Please review this instead. If you've been paying attention to what the Entity Framework team has been saying. You will remember hearing us talk about using the Entity Data Model (EDM) as a common way of describing</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Alex James Is on Point for the Ef dESIGN bLOG</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8663561</link><pubDate>Sat, 28 Jun 2008 17:18:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8663561</guid><dc:creator>Tim Mallalieu's Blog.</dc:creator><description>&lt;p&gt;Although we want all folks from the team to be able to post content as they saw fit on the EF Design&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8666867</link><pubDate>Sun, 29 Jun 2008 12:37:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8666867</guid><dc:creator>PeterV</dc:creator><description>&lt;p&gt;Those computed properties could be very handy in certain cases! Like when you are keeping 'length', 'height' and 'width' properties and want to have a property 'volume' that is calculated for you.&lt;/p&gt;
&lt;p&gt;One thing I'm thinking about is how exceptions raised while evaluating the expressions would/could be handled. &lt;/p&gt;
&lt;p&gt;What if in the example&lt;/p&gt;
&lt;p&gt;&amp;lt;Property Name=&amp;quot;MothersAddress&amp;quot; Type=&amp;quot;Address&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;DefiningExpression&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;it.Mother.Address&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/DefiningExpression&amp;gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;/Property&amp;gt;&lt;/p&gt;
&lt;p&gt;Mother is null, will there be an exception thrown? Or what happens when you do some calculations and get a DivideByZeroException? Will it be possible to put a try/catch inside the DefiningExpression tag?&lt;/p&gt;
&lt;p&gt;Or are exceptions always thrown and is the caller responsible for handling these exceptions?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Peter&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8671372</link><pubDate>Mon, 30 Jun 2008 16:15:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8671372</guid><dc:creator>JorgeLeo</dc:creator><description>&lt;p&gt;To be honest I don't get this one.&lt;/p&gt;
&lt;p&gt;If we are moving into POCO... Why would I define computed properties in the scheme map? What I would do is to have read only properties in C# (or whatever other language) with the formula. Done!&lt;/p&gt;
&lt;p&gt;I'll check for my nulls, I have a much richer environment to express my formulas, and it keeps me in the POCO filosophy.&lt;/p&gt;
&lt;p&gt;The only place where I can see some use of it is when the value of a property mus be calculated as an aggregation of some child objects. But there are already so many ways to do it.&lt;/p&gt;
&lt;p&gt;Regards.&lt;/p&gt;
&lt;p&gt;Jorge&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8671665</link><pubDate>Mon, 30 Jun 2008 19:12:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8671665</guid><dc:creator>timmall</dc:creator><description>&lt;p&gt;@JorgeLeo&lt;/p&gt;
&lt;p&gt;POCO works if you have classes. &lt;/p&gt;
&lt;p&gt;As Alex mentioned, the primary scenario for this is Reporting Services. In reporting services there are no classes, Reporting Services will work against the Entity Client (the EDM aware ADO.NET Provider) and will query using ESQL and get back readers. In this case the computed properties need to be defined in the model they cannot be defined in classes.&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8672033</link><pubDate>Mon, 30 Jun 2008 20:52:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8672033</guid><dc:creator>JorgeLeo</dc:creator><description>&lt;p&gt;@timall&lt;/p&gt;
&lt;p&gt;I understand that the primary scenario is for reporting purposes.&lt;/p&gt;
&lt;p&gt;Still I disagree. &lt;/p&gt;
&lt;p&gt;If there is a calculated value that needs to be displayed as part of the form, then it makes sense to have a calculated property. The class should &amp;quot;know&amp;quot; about the results that the class calculates. The knowledge of the formula and its meaning in the business semantics is something that the class should know.&lt;/p&gt;
&lt;p&gt;Since the class produces the result, this result can be persisted with the rest of the properties. In other words, if the storage is a database (but Persistence Ignorance can override this example), another column needs to be added in the database for the read only property, and it contains the result of that calculation for that particular object.&lt;/p&gt;
&lt;p&gt;From a reporting perspective this is much more efficient since the results are already calculated. From a model perspective it reduces the places where the formula is represented to a single place, in the property definition, added bonus: easier maintenance, and as opposed to having the formula replicated in the report too.&lt;/p&gt;
&lt;p&gt;If the formula needs only to be displayed as consequence of a report, still the class (in my very personal opinion) should be the right place to put it. Like in the case of (for the sake of the argument) windows forms, where we use an MVC model, it should be the same case of the reports. Meaning, do not storing business knowledge in the report definition, the report should be just a read-only paper (or screen) representation of the data. The fact that it makes sense for a particular field to be totaled (as opposed to average or something else) is part of the business knowledge, not part of the report presentation.&lt;/p&gt;
&lt;p&gt;In other words, I think is a reasonable expectative that the reporting tool should be able to query from the POCO, not from the storage. Persistence Ignorance also can say that the objects are stored in a place where common reporting tools cannot reach.&lt;/p&gt;
&lt;p&gt;Reporting services should be extended to support Persistence Ignorance.&lt;/p&gt;
&lt;p&gt;My 2 cents...&lt;/p&gt;
&lt;p&gt;Jorge&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8672588</link><pubDate>Mon, 30 Jun 2008 22:30:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8672588</guid><dc:creator>timmall</dc:creator><description>&lt;p&gt;@Jorge&lt;/p&gt;
&lt;p&gt;I think you are missing the point.&lt;/p&gt;
&lt;p&gt;We are doing work for the RS team, the RS team will not use classes, they will just use EntityDataReader there are no classes in their scenarios. &lt;/p&gt;
&lt;p&gt;The EDM is a data model that is intended to be used across a number of SQL Server services, such as RS, where there is no expectation that CLR classes exist. This scneario is not about POCO or Prescribed Classes, this is about Entity Client and the EDM.&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8672736</link><pubDate>Mon, 30 Jun 2008 23:04:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8672736</guid><dc:creator>JorgeLeo</dc:creator><description>&lt;p&gt;@timmall,&lt;/p&gt;
&lt;p&gt;Question... what comes first? RS or EF?&lt;/p&gt;
&lt;p&gt;Looks one of them will do a sacrifice, and based on your response it sounds like it was already decided EF.&lt;/p&gt;
&lt;p&gt;If RS comes first, then the point is null. Duplication of formulas will be a necesary evil.&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8774458</link><pubDate>Sat, 26 Jul 2008 08:48:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8774458</guid><dc:creator>jrista</dc:creator><description>&lt;p&gt;@JorgeLeo,&lt;/p&gt;
&lt;p&gt;You should open your mind up a bit and look at the larger picture the EF team is targeting. As Timmal said, this 1-Pager has to do with EDM. EDM is a conceptual design language, and the ultimate goal is to provide a common conceptual definition framework that can service many higher level needs, not JUST the needs of programmers. POCO is a need for programmers, and as you said, computed properties can just be done in the class.&lt;/p&gt;
&lt;p&gt;However, when it comes to a different higher level need, such as reporting, there IS no class. RS consumes entities directly from the conceptual model. Not only that, but the developer of a report does not neccesarily have the need, desire, or even right to modify the database to add a computed column or modify a view to provide the required computations at the lowest possible level. &lt;/p&gt;
&lt;p&gt;Having the capability to define computed properties in an expressive manner directly as part of an entity will be a huge, timesaving boon.&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#8795054</link><pubDate>Fri, 01 Aug 2008 00:15:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8795054</guid><dc:creator>jdevonshire</dc:creator><description>&lt;p&gt;Wouldn't the value of a computed property be easier to derive if System.ValueType supported an OnChange event? &amp;nbsp;The event would facilitate rippling and tracking changes across a computed value graph allowing Calculated Properties to reference Calculated Properties in other Entities within the conceptual model.&lt;/p&gt;
&lt;p&gt;Implementing the event in the base Framework shouldn't be too intrusive to merit consideration.&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9023504</link><pubDate>Thu, 30 Oct 2008 05:39:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9023504</guid><dc:creator>shawn</dc:creator><description>&lt;p&gt;I think something like this could be very useful!&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9253775</link><pubDate>Fri, 26 Dec 2008 21:47:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9253775</guid><dc:creator>Alexnaldo Santos</dc:creator><description>&lt;p&gt;Can I uses Compoted Properties into eSQL ? Like :&lt;/p&gt;
&lt;p&gt;&amp;quot;select VALUE &amp;nbsp;from Person as p where p.Mother.Id=10&amp;quot;&lt;/p&gt;
&lt;p&gt;where Mother is a composed property...&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9258995</link><pubDate>Thu, 01 Jan 2009 01:23:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9258995</guid><dc:creator>AlexJ</dc:creator><description>&lt;p&gt;Alexnaldo,&lt;/p&gt;
&lt;p&gt;Hi, Alex James here... long time no talk.&lt;/p&gt;
&lt;p&gt;I will be writing a follow-up post on computed properties and something called Model Defined Functions soon. That will hopefully answer all your questions!&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Alex&lt;/p&gt;
</description></item><item><title>Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9312718</link><pubDate>Tue, 13 Jan 2009 07:27:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9312718</guid><dc:creator>Entity Framework Design</dc:creator><description>&lt;p&gt;A while back I wrote a post that introduced the concept of Computed Properties . Since that time we’ve&lt;/p&gt;
</description></item><item><title>Entity Framework - что нас ждёт в будущем</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9344836</link><pubDate>Tue, 20 Jan 2009 12:32:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9344836</guid><dc:creator>Заметки о Net технологиях</dc:creator><description>&lt;p&gt;Привет всем! At Microsoft PDC2008, Program Manager Tim Mallalieu presented &amp;quot;Entity Fretwork Futures&amp;quot;...&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9419211</link><pubDate>Fri, 13 Feb 2009 19:32:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9419211</guid><dc:creator>Brian P</dc:creator><description>&lt;p&gt;This is great news. &amp;nbsp;I agree with JorgeLeo in the sense that it would be nice if the CLR classes were the model and RS could use these classes as their source. &amp;nbsp;I would rather put these calculated properties in code. &amp;nbsp;But, you can't use those properties in your linq queries, so this will solve that right? &amp;nbsp;So I'm glad it will at least be possible. &amp;nbsp;Any chance that you guys could work on this scenario?&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9456451</link><pubDate>Tue, 03 Mar 2009 13:53:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9456451</guid><dc:creator>Tanveer Badar</dc:creator><description>&lt;p&gt;@ jdevonshire&lt;/p&gt;
&lt;p&gt;Change notification for value types looks like a very desirable feature, until you look at the consequences.&lt;/p&gt;
&lt;p&gt;Value types have no hidden costs when it comes to storage. This is the reason you cannot do things like lock( i ) where i may be an integer.&lt;/p&gt;
&lt;p&gt;Consider how such a change notification would be implemented for a simple case of integer.&lt;/p&gt;
&lt;p&gt;int i = 5; // This may translate to push 5 in x86 terms.&lt;/p&gt;
&lt;p&gt;i = 6; // This may translate to mov eax, 6&lt;/p&gt;
&lt;p&gt;If the runtime was supposed to raise a change notification at the second line, a simple mov won't do that. You need much more baggage than that. A place to hold the delegate reference, a slot in function table to invoke that delegate, etc. Its not a trivial thing to do.&lt;/p&gt;
</description></item><item><title>re: Computed Properties One Pager</title><link>http://blogs.msdn.com/efdesign/archive/2008/06/27/computed-properties-one-pager.aspx#9553048</link><pubDate>Thu, 16 Apr 2009 18:38:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9553048</guid><dc:creator>JLSPublic</dc:creator><description>&lt;p&gt;@Tanveer Badar&lt;/p&gt;
&lt;p&gt;What about having the Property &amp;quot;Set&amp;quot; methods on classes automatically raise the change notification? It seems like a straightforward thing for the CLR to do.&lt;/p&gt;
</description></item></channel></rss>