<?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>Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx</link><description>A while back I wrote a post that introduced the concept of Computed Properties . Since that time we’ve had a number of conversations with both customers and internal partners and we’ve had some new ideas, that have changed our thinking somewhat. First</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9313008</link><pubDate>Tue, 13 Jan 2009 08:33:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9313008</guid><dc:creator>Kristofer</dc:creator><description>&lt;p&gt;My 0.7 baht (== ~2 cent):&lt;/p&gt;
&lt;p&gt;&amp;quot;&amp;lt;i&amp;gt;Do you always pay the cost of materializing the Computed Property even when it is not required?&amp;lt;/i&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;No. Only materialize when called for, otherwise it is not a property or function; always materialized==fields. Always materializing would make computed properties and MDFs banned in many dev shops. (something that _always_ result in [hidden] overhead is a really good way to shoot oneself in the foot)&lt;/p&gt;
&lt;p&gt;Even for non-computed members I think you need to re-think how entities are populated today [in EFv1]. Partially populated entities (without needing a new 'partial' entity definition in the CSDL) is something desperately needed. (northwind example: employee details without photo)&lt;/p&gt;
&lt;p&gt;&amp;quot;&amp;lt;i&amp;gt;CLR properties as stubs for Model Defined Functions&amp;lt;/i&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;No. At least not without a way to flag it as 'not part of the model', e.g. a &amp;quot;[NotInModel()]&amp;quot; or &amp;quot;[EFIgnore()]&amp;quot; attribute.&lt;/p&gt;
&lt;p&gt;I think MDFs should be exposed as regular functions, not property gets. CLR properties on entities should be allowed _without_ anything under it in the model.&lt;/p&gt;
&lt;p&gt;---&lt;/p&gt;
&lt;p&gt;MDFs would already cover 99.5% of the usage scenarios I can imagine for computed properties. 100% if &amp;quot;reverse computation&amp;quot;/&amp;quot;property set&amp;quot; is not supported. That said, computed properties with reverse breakdown/&amp;quot;property set&amp;quot; definitions would be neat. E.g. person name parts &amp;lt;-&amp;gt; person full name.&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9313164</link><pubDate>Tue, 13 Jan 2009 09:16:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9313164</guid><dc:creator>efdesign</dc:creator><description>&lt;p&gt;Kristofer,&lt;/p&gt;
&lt;p&gt;Partial loading as you call it is definitely something we have been considering (i.e. the don't load the big blob unless I really need it scenario). It isn't looking likely in .NET 4.0 though.&lt;/p&gt;
&lt;p&gt;CLR Properties without anything under them in the model are already supported. The caveat of course is the value isn't persisted and it can't be used in a LINQ Query. So I think this is a somewhat orthogonal idea.&lt;/p&gt;
&lt;p&gt;Note: not adding the [EdmFunction] attribute to the CLR property would be the equivalent of adding your [NotInModel()] attribute. &lt;/p&gt;
&lt;p&gt;So I see little point in the [NotInModel()] attribute, essentially it is the default state of a Property that has no corresponding Property in the EntityType.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Alex&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9313983</link><pubDate>Tue, 13 Jan 2009 12:38:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9313983</guid><dc:creator>Kristofer</dc:creator><description>&lt;p&gt;'Partial loading' should be really high up on the feature list IMO - it is very important from a performance perspective...&lt;/p&gt;
&lt;p&gt;Ok, my bad re the attributes. I assumed that &amp;quot;CLR properties as stubs for Model Defined Functions&amp;quot; meant that CLR properties with no mapping would [by default] attempt to find/call a matching function.&lt;/p&gt;
&lt;p&gt;Either way, separating properties and functions in the model so they map to properties and functions in the generated classes is probably a good idea. Very little overhead implementation-wise but allows users the flexibility to choose which one to use.&lt;/p&gt;
&lt;p&gt;And as I mentioned - for properties, an optional definition for 'setter' logic (again defined in ESQL, RegExp, or a method call to an assembly or webservice) would open up a bunch of possibilities:&lt;/p&gt;
&lt;p&gt;&amp;lt;Property Name=&amp;quot;FullName&amp;quot; Type=&amp;quot;String&amp;quot; Nullable=&amp;quot;false&amp;quot; MaxLength=&amp;quot;30&amp;quot; Unicode=&amp;quot;true&amp;quot; FixedLength=&amp;quot;false&amp;quot; Computed=&amp;quot;true&amp;quot; Ordinal=&amp;quot;4&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;DefiningExpression Type=&amp;quot;Get&amp;quot; Language=&amp;quot;ESQL&amp;quot;&amp;gt;FirstName + ' ' + LastName&amp;lt;/DefiningExpression&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;&amp;lt;DefiningExpression Type=&amp;quot;Set&amp;quot; Language=&amp;quot;RegExp&amp;quot;&amp;gt;^(?&amp;lt;Title&amp;gt;[ ][A-Z]+)*(?&amp;lt;FirstName&amp;gt;[A-Z]+)(?&amp;lt;MiddleName&amp;gt;([ ][A-Z]+)?)[ ](?&amp;lt;LastName&amp;gt;([A-Z]+[ ])*([A-Z]+))$&amp;lt;/DefiningExpression&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/Property&amp;gt;&lt;/p&gt;
&lt;p&gt;...or the appropriate extensibility interfaces allowing third-party implementations of the same. :)&lt;/p&gt;
&lt;p&gt;T4 for code generation goes a long way towards the latter, but some additional extensibility points in the visual designer to complement that would be neat; allowing third-party extensions/add-ins to add new properties [mapped to their own 'structural annotation' members] in the designer etc&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9340878</link><pubDate>Tue, 20 Jan 2009 01:11:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9340878</guid><dc:creator>shawn</dc:creator><description>&lt;p&gt;I think having some way to define Computed Properties, either directly or backed by Model Defined Functions, is critical for being able to fully express entities in an entity/object-oriented way. &amp;nbsp;It allows you to define and query data as part of the entity/model itself. &amp;nbsp;Often times this is the preferable way for computed data to be consumed. &amp;nbsp;It certainly is in our scenarios. &amp;nbsp;This is one of the features we are most excited about.&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9346790</link><pubDate>Tue, 20 Jan 2009 16:16:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9346790</guid><dc:creator>Pedro</dc:creator><description>&lt;p&gt;Sorry to go a little of topic here, but I was wondering if I could download a preview version of EF v2 just to play with it.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9351155</link><pubDate>Wed, 21 Jan 2009 00:10:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9351155</guid><dc:creator>dsimmons@microsoft.com</dc:creator><description>&lt;p&gt;EF v2 preview is not available yet. &amp;nbsp;We're working on that and will make something available as soon as we reasonably can.&lt;/p&gt;
&lt;p&gt;- Danny&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9356402</link><pubDate>Wed, 21 Jan 2009 16:06:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9356402</guid><dc:creator>Pedro Brown</dc:creator><description>&lt;p&gt;Thank you for your answer Danny.&lt;/p&gt;
&lt;p&gt;I have to say that I'm really excited about what is beeing done in the EF. What I want to know is: Can we make suggestions to make EF more a MDD framework, or it's purpose is just to be an O/R M and leave the MDD area to Oslo?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9356420</link><pubDate>Wed, 21 Jan 2009 16:17:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9356420</guid><dc:creator>Pedro Brown</dc:creator><description>&lt;p&gt;Sorry, MDD is (Model Driven Desing), but I think that what you guys use is DDD (Domain Driven Desing).&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;
</description></item><item><title>re: Update on Computed Properties</title><link>http://blogs.msdn.com/efdesign/archive/2009/01/13/update-on-computed-properties.aspx#9428379</link><pubDate>Tue, 17 Feb 2009 22:55:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9428379</guid><dc:creator>Ike</dc:creator><description>&lt;p&gt;One great benefit of computed properties would be to add non-model data to entites being delivered via REST (ADO.NET Data Services). &amp;nbsp;Interjecting &amp;quot;computed&amp;quot; data into my entites has become absolutely necessary and since I...&lt;/p&gt;
&lt;p&gt; - can't do that with EF (computed properties would be nice?) so ADO.NET Data Services is out&lt;/p&gt;
&lt;p&gt; - can't return a JSON-serialized object that includes a EF entity item from a WCF operation if that EF entity includes a reference to another EF entity (known issue...very specific error occurs if you try to do that)&lt;/p&gt;
&lt;p&gt;...I have had to resort to creating separate contract types for each EF entity type I want to return as JSON.&lt;/p&gt;
&lt;p&gt;If EF allowed me to add computed properties, I could scrap most of my contract types.&lt;/p&gt;
</description></item></channel></rss>