<?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>Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx</link><description>Today the Entity Framework, and more specifically the Entity Data Model, have a limited notion of Functions. 
 We are currently restricted to Function Imports that allow stored procedures to be invoked, and Canonical / Store Functions for database independent</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9962827</link><pubDate>Fri, 12 Feb 2010 20:08:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9962827</guid><dc:creator>efNewbie</dc:creator><description>&lt;p&gt;First off . . . I am a complete newbie to &amp;quot;APPLIED&amp;quot; EF (read about, seen it at Code Camp).&lt;/p&gt;
&lt;p&gt;After a not terribly painful week . . . &lt;/p&gt;
&lt;p&gt;I have the EF implemented in a grid for a very basic header-detail (2 tables).&lt;/p&gt;
&lt;p&gt;I am however feeling a bit nervous re: can the EF do all we need.&lt;/p&gt;
&lt;p&gt;I read people who trash EF as not ready for prime time . . . as a &amp;#189;-way there technology.&lt;/p&gt;
&lt;p&gt;Here's where I stand in the trench at the moment . . . &lt;/p&gt;
&lt;p&gt;The detail records are presented in a asp:GridView &lt;/p&gt;
&lt;p&gt; &amp;nbsp;with ['Edit' 'Delete' 'Select'] in the leftmost column. &lt;/p&gt;
&lt;p&gt;'Edit' works (though the hiding of columns appears to only be doable following setting the DataSource).&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Is there a way in the EDMX mapping to leave out columns. Apparently no . . . all columns MUST be mapped.&lt;/p&gt;
&lt;p&gt;'Delete' works . . . but how to 'Delete Confirm ?'. Javascript ?&lt;/p&gt;
&lt;p&gt;'Select' . . . I don't understand. What is it doing ? How do I wire an imported function to 'Select'.&lt;/p&gt;
&lt;p&gt; &amp;nbsp;My current biggest hurdle of the moment is how to 'filter' the Select sproc.&lt;/p&gt;
&lt;p&gt;I am right now struggling with try to accomplish filtering based on several DropDownLists on the form&lt;/p&gt;
&lt;p&gt;by passing parameters to the .Where of the ObjectQuery, but the .Execute is failing:&lt;/p&gt;
&lt;p&gt; &amp;nbsp;&amp;quot;'tblTable.FieldName' could not be resolved in the current scope or &lt;/p&gt;
&lt;p&gt;context. Make sure that all referenced variables are in scope, that required &lt;/p&gt;
&lt;p&gt;schemas are loaded, and that namespaces are referenced correctly., near &lt;/p&gt;
&lt;p&gt;multipart identifier, line 6, column 47.&amp;quot;&lt;/p&gt;
&lt;p&gt;More questions:&lt;/p&gt;
&lt;p&gt; &amp;nbsp;1. What are the options for the 'Operator' column of the mapping dialog of the Model Browser ?&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;There is no dropdown list here.&lt;/p&gt;
&lt;p&gt; &amp;nbsp;2. Can DropDownLists be added to the asp:GridView cells ? and is sample code available to do that ?&lt;/p&gt;
&lt;p&gt;And finally a clarification:&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Could it be said that the EF is the new version of what has been known as &amp;quot;Typed Datasets&amp;quot; ?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9962827" width="1" height="1"&gt;</description></item><item><title>re: Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9616122</link><pubDate>Thu, 14 May 2009 17:31:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9616122</guid><dc:creator>Daniel Simmons</dc:creator><description>&lt;p&gt;@Muhammad,&lt;/p&gt;
&lt;p&gt;These functions are just used to give the function signature for us to figure out how to translate into a part of the overall query sent to the server. &amp;nbsp;As such the return type does not need to be IQueryable--it can be just IEnumerable.&lt;/p&gt;
&lt;p&gt;Once the query has been executed and the results returned, if the results are entities, then lazy loading will work the same as for any other entities. &amp;nbsp;Eager loading can also work because this is just a rewrite over the query to bring along extra data.&lt;/p&gt;
&lt;p&gt;Yes, it will work fine for whatever entities you have--POCO or non-POCO.&lt;/p&gt;
&lt;p&gt;- Danny&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9616122" width="1" height="1"&gt;</description></item><item><title>Entity Framework: функции определенные в модели</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9615907</link><pubDate>Thu, 14 May 2009 16:21:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9615907</guid><dc:creator>progg.ru</dc:creator><description>&lt;p&gt;Thank you for submitting this cool story - Trackback from progg.ru&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9615907" width="1" height="1"&gt;</description></item><item><title>re: Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9615072</link><pubDate>Thu, 14 May 2009 11:01:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9615072</guid><dc:creator>Muhammad Mosa</dc:creator><description>&lt;p&gt;As this going to support Linq, the return type of Fucntions that return collection would be of type IQueryable right?&lt;/p&gt;
&lt;p&gt;Also in case function return colletion of entities does eager and lazy loading work on this case?!&lt;/p&gt;
&lt;p&gt;I also assume it will support POCO entities by default! Am I right?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9615072" width="1" height="1"&gt;</description></item><item><title>Entity Framework Design : Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9614856</link><pubDate>Thu, 14 May 2009 10:27:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9614856</guid><dc:creator>DotNetShoutout</dc:creator><description>&lt;p&gt;Thank you for submitting this cool story - Trackback from DotNetShoutout&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9614856" width="1" height="1"&gt;</description></item><item><title>re: Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9457161</link><pubDate>Tue, 03 Mar 2009 20:59:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9457161</guid><dc:creator>Bruno Santos</dc:creator><description>&lt;p&gt;Hi. That's a great post! Its exacly what I wanted.&lt;/p&gt;
&lt;p&gt;The problem is, it seems the atribute doesn't exist in the VB.NET is that possible?&lt;/p&gt;
&lt;p&gt;I can only find 2 sites exposing this subject, yours and this:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/efdesign/archive/2008/10/08/edm-and-store-functions-exposed-in-linq.aspx"&gt;http://blogs.msdn.com/efdesign/archive/2008/10/08/edm-and-store-functions-exposed-in-linq.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9457161" width="1" height="1"&gt;</description></item><item><title>Update on Computed Properties</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9312719</link><pubDate>Tue, 13 Jan 2009 07:27:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9312719</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;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9312719" width="1" height="1"&gt;</description></item><item><title>re: Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9306730</link><pubDate>Mon, 12 Jan 2009 05:29:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9306730</guid><dc:creator>efdesign</dc:creator><description>&lt;p&gt;Shawn,&lt;/p&gt;
&lt;p&gt;Well it is not something we have done yet. But it is something we are considering. All we need to do is allow the [EdmFunction] attribute on properties and treat the declaring class as the first parameter in the MDF implicitly&lt;/p&gt;
&lt;p&gt;Sort of like the reverse of Extension Methods I suppose.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Alex&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9306730" width="1" height="1"&gt;</description></item><item><title>re: Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9304689</link><pubDate>Sun, 11 Jan 2009 00:09:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9304689</guid><dc:creator>shawn</dc:creator><description>&lt;p&gt;Would it be possible to do this for non-static functions as well, so that you can write the queries in a more object-oriented way? &amp;nbsp;So instead of:&lt;/p&gt;
&lt;p&gt;var peopleOver21 =&lt;/p&gt;
&lt;p&gt;from p in ctx.People&lt;/p&gt;
&lt;p&gt;where GetAge(p) &amp;gt; 21&lt;/p&gt;
&lt;p&gt;select p;&lt;/p&gt;
&lt;p&gt;Could you map it such that you could query like this:&lt;/p&gt;
&lt;p&gt;var peopleOver21 =&lt;/p&gt;
&lt;p&gt;from p in ctx.People&lt;/p&gt;
&lt;p&gt;where p.Age &amp;gt; 21&lt;/p&gt;
&lt;p&gt;select p;&lt;/p&gt;
&lt;p&gt;That way you are calling p.Age instead of GetAge(p)? &amp;nbsp;It seems like that would be a cleaner, more OO way to consume the data in many cases.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9304689" width="1" height="1"&gt;</description></item><item><title>re: Model Defined Functions</title><link>http://blogs.msdn.com/b/efdesign/archive/2009/01/07/model-defined-functions.aspx#9302804</link><pubDate>Sat, 10 Jan 2009 01:21:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9302804</guid><dc:creator>efdesign</dc:creator><description>&lt;p&gt;Julie,&lt;/p&gt;
&lt;p&gt;I'm sure some will complain. We all have different ideas about how things should be done. &lt;/p&gt;
&lt;p&gt;Personally I don't see the conceptual difference between a Model Defined Function and WebService end point. The only difference is that the Entity Framework automatically handles calls to the MDFs.&lt;/p&gt;
&lt;p&gt;And given that you can write Model Declared Functions too (i.e. no definition) you can separate out the implementation from the declaration too, if you think that is important. &lt;/p&gt;
&lt;p&gt;If you do that of course, then you need to handle calls to the function yourself.&lt;/p&gt;
&lt;p&gt;Am I making any sense?&lt;/p&gt;
&lt;p&gt;Alex&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9302804" width="1" height="1"&gt;</description></item></channel></rss>