简体   繁体   中英

Calling store procedure from dot net framework 3.5 using entity framework 4.0

How to call store procedure which returns data from more than one table from entity framework 4.0 in dot net 3.5 . As while generating import function from store procedure , complex data type is not allowed in dot.net 3.5 .Same thing works fine with dot net framework 4.0 . Is there any way out to work with dot net framework 3.5 using entity framework 4.0

I don't believe it's supported in EF 4.0 I do know that it's supported in EF 6.0

I'd recommend upgrading if it's possible.

Here's some sample code I found (link provided below)

public virtual int AddCustomerInDivision(Nullable<int> CustId, string Division)
{
  var CustIdParameter = CustId.HasValue ?
    new ObjectParameter("CustId", CustId) :
    new ObjectParameter("CustId", typeof(int));

  var DivisionParameter = Division != null ?
    new ObjectParameter("Division", Division) :
    new ObjectParameter("Division", typeof(string));

  return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction(
    "DeleteCustomer", CustIdParameter, DivisionParameter);
}

Link to Article

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM