Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Good Day!

I am new to Entity framework. I am having existing oracle db with several stored procedures which having multiple ref cursors. Now I am trying to access those stored procedures by using EF6 code first approach. How can i do this please help me.

For example I am having Country.cs as below:

C#
public partial class Country
   {
       public decimal Id { get; set; }
       public string Code { get; set; }
       public string Name { get; set; }
       public string ForeignName { get; set; }
       public string StateFlag { get; set; }
       public string ZipCodeFlag { get; set; }
       public string EUFlag { get; set; }
       public string CrossBookingFlag { get; set; }
       public string Status { get; set; }
       public Nullable<System.DateTime> CreatedOn { get; set; }
       public Nullable<decimal> LastUpdatedBy { get; set; }
       public Nullable<System.DateTime> LastUpdatedOn { get; set; }
       public Nullable<decimal> PurgeYear { get; set; }
   }


and I am having Oracle stored procedure "ibp_country_mstr_getlist" like below:

C#
procedure ibp_country_mstr_getlist
          (       
           p_country_id   in     number,           
           p_cntry_getlist out   SYS_REFCURSOR
           )as
 begin
      open   p_cntry_getlist  for
      select /*+index(ibt_country_master country_mas_status_idx)*/country_pid,country_code,country_name,country_fname
     from     ibt_country_master
    where     country_pid=p_country_id
    and       country_status in ('A','D');
 end;


How can I access this stored procedure using ef6 code first for existing db and assign the returning result set to List<country>?

Thanks and Regards,
Aswin S P
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900