<?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>Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx</link><description>In this blog post, we’d like to walk through the EDM designer’s support for specifying insert, update, and delete stored procedures for entity types. Each of these stored procedure types has some non-obvious requirements and capabilities and we’d especially</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>EF : deux nouveaux posts de l'ADO .Net Team</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8341262</link><pubDate>Fri, 28 Mar 2008 11:53:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8341262</guid><dc:creator>Matthieu MEZIL</dc:creator><description>&lt;p&gt;L'ADO .Net Team vient de poster deux nouveaux posts : le premier concerne l'utilisation des proc&amp;#233;dures&lt;/p&gt;
</description></item><item><title>Stored Procedure Mapping Overview</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8343548</link><pubDate>Sat, 29 Mar 2008 18:43:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8343548</guid><dc:creator>Hot Topics</dc:creator><description>&lt;p&gt;Noam Ben-Ami, from the EF Tools team shows how to use the Entity Framework Designer tools to map Store&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8346986</link><pubDate>Tue, 01 Apr 2008 03:54:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8346986</guid><dc:creator>Tony</dc:creator><description>&lt;p&gt;After attempting a similar example on my own and I get the following exception:&lt;/p&gt;
&lt;p&gt;Error 2027: If an entity set or association set includes a function mapping, all related entity and association sets in the entity container must also define function mappings. The following sets require function mappings: Report2Queries.&lt;/p&gt;
&lt;p&gt;THe Report2Queries is an 1 to many association between a Report and its queries. &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8348537</link><pubDate>Tue, 01 Apr 2008 20:45:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8348537</guid><dc:creator>Noam Ben-Ami</dc:creator><description>&lt;p&gt;Tony,&lt;/p&gt;
&lt;p&gt; I assume that you have a report entity and a query entity, and that a report can contain many queries. I also assume that the query table has a foreign key to the report entity, something like reportId. Finally, I assume that your query entity has a navigation property, probably called report, which means that the insert, update, and delete stored procedures must have a parameter called reportId, as detailed in the blog entry.&lt;/p&gt;
&lt;p&gt; Given all of that, you need to map report.reportId on the query type to the reportId parameter on the insert, update, and delete stored procedures.&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8398937</link><pubDate>Wed, 16 Apr 2008 15:18:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8398937</guid><dc:creator>Roman Dynnik</dc:creator><description>&lt;p&gt;&amp;gt;&amp;gt;&amp;gt;The value of the id column from the stored procedure’s return table will now be mapped back to the entity...&lt;/p&gt;
&lt;p&gt;Good article, thanks!&lt;/p&gt;
&lt;p&gt;I have some quetions:&lt;/p&gt;
&lt;p&gt;1. Is it possible map back to the entity a out(inout)-parameter from stored procedure?&lt;/p&gt;
&lt;p&gt;2. Is it possible map to a parameter of stored procedure any variable or property from other object (for example, I need to pass a ticketID)&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8418453</link><pubDate>Wed, 23 Apr 2008 10:24:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8418453</guid><dc:creator>Andrey Balykov</dc:creator><description>&lt;p&gt;I've a problem with using Stored proc in Entity Framework Model. &lt;/p&gt;
&lt;p&gt;For simple Example, I've 2 tables (and Entities), Prices (PriceID primary key, CategoryID, price) and Category (CategoryID primary key, CategoryName). I've relation FK_Prices_Category&lt;/p&gt;
&lt;p&gt;I was made EDM with stored proc - all OK. But I can't make Deleting prom Price entity.&lt;/p&gt;
&lt;p&gt;My code:&lt;/p&gt;
&lt;p&gt;01 VmzkoPricesEntities ctx = new VmzkoPricesEntities();&lt;/p&gt;
&lt;p&gt;02 VmzkoPricesModel.Prices pr = ctx.GetPriceByID(newsID).First&amp;lt;VmzkoPricesModel.Prices&amp;gt;();&lt;/p&gt;
&lt;p&gt;03 ctx.DeleteObject(pr);&lt;/p&gt;
&lt;p&gt;04 ctx.SaveChanges(true);&lt;/p&gt;
&lt;p&gt;GetPriceByID - is an imported stored proc with output of all fields of Prices (PriceID, CategoryID, price) BUT if I expand 'pr' object (row 02) then property Category is NULL.&lt;/p&gt;
&lt;p&gt;After that deleting is not available: Entities in 'VmzkoPricesEntities.Prices' participate in the 'FK_Prices_Category' relationship. 0 related 'Category' were found. Between 1 and 1 'Category' are expected. &lt;/p&gt;
&lt;p&gt;How can I fill Category property inside Prices object by using stored proc???&lt;/p&gt;
&lt;p&gt;How can I fill that by alternative method?&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8519075</link><pubDate>Mon, 19 May 2008 17:12:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519075</guid><dc:creator>Arye Friedman</dc:creator><description>&lt;p&gt;Hi Noam,&lt;/p&gt;
&lt;p&gt;Do you plan to implement a wizard that will be able to port (not just map) &amp;nbsp;stored procedures with a non-trivial logic to LINQ code? &amp;nbsp;The purpose is to run these converted stored procedures using EF approach against another data source which does not contain any logic but just data.&lt;/p&gt;
</description></item><item><title>[Entity Framework] Error “AssociationSets must be consistently mapped for all operations”. Mapear asociaciones en Store Procedure de Delete</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#8890792</link><pubDate>Sun, 24 Aug 2008 00:47:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8890792</guid><dc:creator>&lt;Jose A. Fernandez /&gt;</dc:creator><description>&lt;p&gt;Con un proyecto donde estoy probando Entity Framework , para ir mas alla de lo simple a lo que estamos&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9000945</link><pubDate>Wed, 15 Oct 2008 23:14:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000945</guid><dc:creator>Skeptic</dc:creator><description>&lt;p&gt;I stopped reading after &amp;quot;We hope to provide a solution for this issue in future versions of the Entity Framework...&amp;quot; because this told me everything I need to know: EF is &amp;quot;not ready for prime time&amp;quot;. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I look forward to revisiting EF once it becomes realistic enough to use out of the box without a lot of &amp;quot;magic work-around coding&amp;quot; that requires a PHD in Computer Sciene or worse, breaks when the next edition of EF comes out.&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9025008</link><pubDate>Thu, 30 Oct 2008 21:36:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9025008</guid><dc:creator>richardcollette</dc:creator><description>&lt;p&gt;Definitely frustrated by limitations myself as well. &amp;nbsp;I simply want to get a collection of read only entities from a table (a list of US States) using &amp;nbsp;a stored procedure. &amp;nbsp;Issues are:&lt;/p&gt;
&lt;p&gt;I must map the entity to a store table or view, even when updates are not going to be performed.&lt;/p&gt;
&lt;p&gt;The entity must map all primary keys to the store table, even though I only require a portion of the table values returned.&lt;/p&gt;
&lt;p&gt;Clearly the read only use case was not focused on in the design much. &amp;nbsp;As a result, EF seems to tie my data access to the physical store more so than ever.&lt;/p&gt;
&lt;p&gt;It's interesting that this is so poor because it works fairly well in Linq to SQL except that I cannot specify a name for the return type or its properties. &amp;nbsp;I have to live with the autogenerated return type.&lt;/p&gt;
&lt;p&gt;Please take this use case into account in the next release.&lt;/p&gt;
</description></item><item><title>Entity Framework:entity client 调用存储过程</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9244125</link><pubDate>Sat, 20 Dec 2008 19:14:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9244125</guid><dc:creator>davin</dc:creator><description>&lt;p&gt;如果对于sp在EDM的映射有一些了解的话，可以很清楚的明白，在EDM中映射一个sp返回的类型包括：Entity Type，Scalars Type,None；这三中类型分别对应的sp返回内容对应到数据库，表的层面就是：（Entity）一张表的所有字段或若干字段(必须包括主键）;（Scalars）返回一个常量（int, varchar）可以是数据库的一个字段，可以是sum,count,left...等函数操作的结果;(none)自然是什么都不返回.这里自然就有一个严重的问题，对于返回（multiple&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9257058</link><pubDate>Tue, 30 Dec 2008 16:08:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9257058</guid><dc:creator>Margaret</dc:creator><description>&lt;p&gt;I got a similar error 2027 to Tony, and provided mappings for the association set. &amp;nbsp;However, in my case, the relationship is 1 to 0..1 and when I mapped the Key of the dependent table to the PK of the independent table in all three Function mappings (as instructed), I got a slightly different error:&lt;/p&gt;
&lt;p&gt;Error 2027: If an EntitySet or AssociationSet includes a function mapping, all related entity and AssociationSets in the EntityContainer must also define function mappings. &lt;/p&gt;
&lt;p&gt;It went on to say that the Independent table required function mappings, even though up to now I was able to save changes using the regular .SaveChanges Method. &amp;nbsp;Is this because of the 1 to 0..1 relationship?&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9341782</link><pubDate>Tue, 20 Jan 2009 06:07:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9341782</guid><dc:creator>D.Asuncion</dc:creator><description>&lt;p&gt;Olahhhh.. Amigo... I Cannot Run.. I got some error.. &amp;nbsp;like this : &lt;/p&gt;
&lt;p&gt;error 2037: A mapping function bindings specifies a function EDMXModel.Store.Order_Insert but does not map the following function parameters: productId.&lt;/p&gt;
&lt;p&gt;5 Ado.Net Team Reference.App_Code.Model.msl(61,6) : error 2048: The EntitySet 'Order' includes function mappings for AssociationSet 'FK_Order_Product', but none exists in element 'InsertFunction' for type 'EDMXModel.Order'. AssociationSets must be consistently mapped for all operations.&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9343085</link><pubDate>Tue, 20 Jan 2009 08:29:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9343085</guid><dc:creator>D.Asuncion</dc:creator><description>&lt;p&gt;I fixed it now... Thank you very much..for the article.&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9373401</link><pubDate>Sat, 24 Jan 2009 03:25:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9373401</guid><dc:creator>David J.</dc:creator><description>&lt;p&gt;I've started today working on an ADO.NET entity model using stored procedures, and I have to say I'm underwhelmed. Some of the serious limitations:&lt;/p&gt;
&lt;p&gt;1) Cannot map output parameters from the insert sproc back to entity properties - only the return value. If you have an existing sproc that returns the identity value as an output parameter, guess what - you'll have to rewrite it. If you're procedure passes back multiple output parameters, then you're screwed - you'll have to rethink your design.&lt;/p&gt;
&lt;p&gt;2) If you choose sproc mapping you MUST provide an insert, update and delete procedure. Never mind if you don't intent to support all of those semantics. I found a bug reported on this. The fix was postponed, and to paraphrase the workaround provided: &amp;quot;If you're not doing full CRUD, then don't use EF.&amp;quot; I guess a model where there are some entities that don't actually support full CRUD semantics is beyond the EF team's comprehension.&lt;/p&gt;
&lt;p&gt;3) You can apparently only have one procedure per operation. So let's say you want multiple delete procedures - one to delete a specific order, one to delete all orders for a customer, etc. There's apparently no way to do that unless you cram it all into one sproc.&lt;/p&gt;
&lt;p&gt;4) While futzing with these limitation I had to iterate on DB changes to workaround them and the entity designer got confused several times. After mucking with the raw XML and not getting anywhere, I regenerated the project from scratch and it worked fine. This doesn't give me much confidence in the ability of the designer to cope with an evolving data model.&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9574653</link><pubDate>Wed, 29 Apr 2009 03:12:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9574653</guid><dc:creator>jason chan</dc:creator><description>&lt;p&gt;what is the point of mapping all the stored procedures with all the insert/update/delete?&lt;/p&gt;
&lt;p&gt;what if i don't do it? &amp;nbsp;what will happen?&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9574674</link><pubDate>Wed, 29 Apr 2009 03:27:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9574674</guid><dc:creator>jason chan</dc:creator><description>&lt;p&gt;i just tried removing the stored procedure mapping for delete function with the delete stored procedure, so the code will stop at this line&lt;/p&gt;
&lt;p&gt;foreach(Product p in context1.Product) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;context1.DeleteObject(p)&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;it will say:&lt;/p&gt;
&lt;p&gt;Mapping Exception was unhandled&lt;/p&gt;
&lt;p&gt;Schema specified is not valid. Errors: 2025&lt;/p&gt;
&lt;p&gt;So, I think if you do all the stored procedure mapping with all your entities...then you can just use all the add, delete, update easier.&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9574683</link><pubDate>Wed, 29 Apr 2009 03:33:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9574683</guid><dc:creator>jason chan</dc:creator><description>&lt;p&gt;i tried to remove the stored procedure mapping for insert function on product...&lt;/p&gt;
&lt;p&gt;so i will get the same error (mapping exception was unhandled) from this line&lt;/p&gt;
&lt;p&gt;foreach(Product p in context1.Product)&lt;/p&gt;
&lt;p&gt;so, I must do all the mapping before I can use the above code?&lt;/p&gt;
</description></item><item><title>re: Stored Procedure Mapping</title><link>http://blogs.msdn.com/adonet/archive/2008/03/26/stored-procedure-mapping.aspx#9894432</link><pubDate>Sat, 12 Sep 2009 01:28:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9894432</guid><dc:creator>Kreshiv</dc:creator><description>&lt;p&gt;Thanks Man. I was searching for the meaning of this error for 2 days.. &lt;/p&gt;
&lt;p&gt;Hope I can try and resolve it now. &lt;/p&gt;
</description></item></channel></rss>