Entity Framework with Output parametersI have a stored procedure with one output parameter. The procedure returns an Entity. I do the function import and eveything and the entity is returning fine. However the output parameter value is not being updated. I searched everywhere and I still am not sure if output parameters are supported by entity framework or not. I appreciate if someone could help me with these questions:<br/><br/>1) After function import, the function signature creates an ObjectParameter for the output parameter, but the rest of In parameters are generated as regular types (like string , int,...). Why is EF distinguishing between the two?<br/>2) Does EF support output paramenters or not? <br/>3) Does EF 4.0 Beta support output parameters?<br/><br/><br/>The way it is right now it seems that I can never read a return value from a stored  procedures or get the value of an Output parameter updated.<br/><br/>Thanks© 2009 Microsoft Corporation. All rights reserved.Fri, 07 Aug 2009 23:16:32 Z2b90a21c-9276-4538-9b49-893e30b1f591http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#2b90a21c-9276-4538-9b49-893e30b1f591http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#2b90a21c-9276-4538-9b49-893e30b1f591Bob-Kayhttp://social.msdn.microsoft.com/Profile/en-US/?user=Bob-KayEntity Framework with Output parametersI have a stored procedure with one output parameter. The procedure returns an Entity. I do the function import and eveything and the entity is returning fine. However the output parameter value is not being updated. I searched everywhere and I still am not sure if output parameters are supported by entity framework or not. I appreciate if someone could help me with these questions:<br/><br/>1) After function import, the function signature creates an ObjectParameter for the output parameter, but the rest of In parameters are generated as regular types (like string , int,...). Why is EF distinguishing between the two?<br/>2) Does EF support output paramenters or not? <br/>3) Does EF 4.0 Beta support output parameters?<br/><br/><br/>The way it is right now it seems that I can never read a return value from a stored  procedures or get the value of an Output parameter updated.<br/><br/>ThanksFri, 19 Jun 2009 00:42:05 Z2009-06-19T00:42:05Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#5026ea2c-36a7-4120-9d43-41040f4fd731http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#5026ea2c-36a7-4120-9d43-41040f4fd731Cankut Eskinhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cankut%20EskinEntity Framework with Output parametersUse <span style="text-decoration:underline"><strong>exactly</strong> </span> the same variable name for your ObjectParameter in your imported function's signature.<br/> <br/> <br/> ObjectParameter <span style="text-decoration:underline"><strong>myParameter</strong> </span> = new ObjectParameter(&quot;<span style="text-decoration:underline">MyParameter</span> &quot;, typeof(int));<br/> <br/> From edmx:<br/> <pre lang=x-xml>&lt;Function Name=&quot;MyFunction&quot; Aggregate=&quot;false&quot; BuiltIn=&quot;false&quot; NiladicFunction=&quot;false&quot; IsComposable=&quot;false&quot; ParameterTypeSemantics=&quot;AllowImplicitConversion&quot; Schema=&quot;dbo&quot;&gt;<br/> &lt;Parameter Name=&quot;MyParameter&quot; Type=&quot;int&quot; Mode=&quot;InOut&quot; /&gt;<br/> &lt;/Function&gt;</pre> <br/> From .designer.cs:<br/> <pre lang="x-c#">public global::System.Data.Objects.ObjectResult&lt;MyEntityType&gt; SearchMyEntity(global::System.Data.Objects.ObjectParameter myParameter)</pre> <br/> <br/> Cankut<br/>Sat, 20 Jun 2009 22:47:32 Z2009-06-20T22:48:15Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#6513dab9-1470-4597-970c-9db0f2112807http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#6513dab9-1470-4597-970c-9db0f2112807Bob-Kayhttp://social.msdn.microsoft.com/Profile/en-US/?user=Bob-KayEntity Framework with Output parametersThanks Cankut, but unfortunately it did not work for me. <br/><br/><br/>Is it something that is working for you?Sun, 21 Jun 2009 18:42:55 Z2009-06-21T18:42:55Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#0cb442a3-830e-4dba-9faa-33f9deac95adhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#0cb442a3-830e-4dba-9faa-33f9deac95adCankut Eskinhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cankut%20EskinEntity Framework with Output parametersSorry my mistake, nothing to do with variable names.<br/> <br/> But the parameter name you declared in SP should be equal to name you use in the ObjectParameter.<br/> <br/> My SP parameter was declared as <strong>@TotalRecordCount</strong> in the database. <br/> <br/> On the code side it was <br/> <br/> ObjectParameter prm = new ObjectParameter(&quot;<strong>totalRecordCount</strong> &quot;, typeof(int));<br/> <br/> The output parameter was not updated in this case.<br/> <br/> When we change <strong>totalRecordCount -&gt; </strong> <strong>TotalRecordCount</strong> it started to work.<br/> <br/> <br/> <br/> Check your SP script and make sure that you use the same name in the ObjectParameter.<br/> <br/> SP:<br/> CREATE PROCEDURE  [dbo].[MyFunction] (<br/>     @TotalRecordCount int = 0 output<br/> )<br/> <br/> ObjectParameter prm = new ObjectParameter(&quot;TotalRecordCount&quot;, typeof(int));<br/> <br/> <br/> <br/> Hope this helps,<br/> <br/> Cankut<br/>Mon, 22 Jun 2009 07:49:28 Z2009-06-22T07:49:28Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#67e6d0d9-ca00-46f2-9a4a-0915f23962b7http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#67e6d0d9-ca00-46f2-9a4a-0915f23962b7Bob-Kayhttp://social.msdn.microsoft.com/Profile/en-US/?user=Bob-KayEntity Framework with Output parametersThanks. It is still not working for me.Mon, 22 Jun 2009 19:04:50 Z2009-06-22T19:04:50Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#a32d9c6b-5318-469f-9781-89a44d731b18http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#a32d9c6b-5318-469f-9781-89a44d731b18zeeshan hiranihttp://social.msdn.microsoft.com/Profile/en-US/?user=zeeshan%20hiraniEntity Framework with Output parameters<p>i have stopped doing EF v1 for a while so i cant say much in this but i can tell u the story for what i tried in v4 that worked for me. I have a stored procedure that returns resultset as well output paramter. suppose the method call generated on the objectcontex is like this<br/><br/>var parameter = new ObjectParameter(&quot;TotalCustomer&quot;, ParamterType.Int) .. (something like that)<br/>var custs = db.GetCusts(paramter);<br/><br/>foreach(var cust in custs)<br/>{<br/>--do someitng<br/>}<br/><br/>int totalcusts = paramter.Value as int;<br/><br/>the point is u have to iterate through the resultset first before u can get the value back for output paramter.<br/><br/>Zeeshan hirani</p>Fri, 10 Jul 2009 05:35:19 Z2009-07-10T05:35:19Zhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#a453f03d-8220-4af7-bf4e-e108d2453718http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/2b90a21c-9276-4538-9b49-893e30b1f591#a453f03d-8220-4af7-bf4e-e108d2453718Julia Kornichhttp://social.msdn.microsoft.com/Profile/en-US/?user=Julia%20KornichEntity Framework with Output parametersHi, Ijust did the following and it worked:<br/><br/>Added the following sporc to my SQL Server:<br/> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;color:blue;font-family:'Courier New'">CREATE</span><span style="font-size:10pt;font-family:'Courier New'"> <span style="color:blue">PROCEDURE</span> GetProductName</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Courier New'">      @ID <span style="color:blue">int</span><span style="color:gray">,</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Courier New'">      @Name <span style="color:blue">nvarchar</span><span style="color:gray">(</span>50<span style="color:gray">)</span> <span style="color:blue">OUTPUT</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Courier New'">      <span style="color:blue">AS</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Courier New'">      <span style="color:blue">SELECT</span> @Name <span style="color:gray">=</span> Name <span style="color:blue">FROM</span> Production<span style="color:gray">.</span>Product</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Courier New'">      <span style="color:blue">WHERE</span> ProductID <span style="color:gray">=</span> @ID<br/><br/>I imported the function. The following code returns the value in the output param.<br/><br/></span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">                    ObjectParameter id = new ObjectParameter(&quot;ID&quot;, 1);</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">                    ObjectParameter name = new ObjectParameter(&quot;Name&quot;, typeof(String));</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">                    context.GetProductName(productID, name);</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:small;font-family:Calibri">                    Console.WriteLine(name.Value);</span></p> <p class=MsoNormal style="margin:0in 0in 0pt"> </p><hr class="sig">This posting is provided &quot;AS IS&quot; with no warranties, and confers no rights.Fri, 07 Aug 2009 23:16:32 Z2009-08-07T23:16:32Z