none
How do I to set fields of partial using entity framework? RRS feed

  • Question

  • I have two partial classes, the one generated from the entity framework model and a seperate one with additional fields. I have a stored procedure mapped to return the OrderDetail, field1 and field2. Is there a way to set or map the additional fields(field2)?
    
    //EF generated classes
    partial class OrderDetail {
      public int orderid {get; set;}
      public string field1 {get; set;}
    }
    
    // custom code
    partial class OrderDetail {
      public string field2 {get; set;}
    }
    
    
    //generated ef code
    //this stored procedure returns orderid, field1, field2.
    public ObjectResult<OrderDetail> GetDetailsForOrder
        (Nullable<global::System.Int32> orderid)
    {
    ObjectParameter orderidParameter;
    if (orderid.HasValue)
    {
     orderidParameter = new ObjectParameter("orderid", orderid);
    }
    else
    {
     orderidParameter = new ObjectParameter("orderid", typeof(global::System.Int32));
    }
     return base.ExecuteFunction<OrderDetail>("GetDetailsForOrder", orderidParameter);
    }


    • Edited by jon_ee Monday, October 14, 2013 12:39 AM
    • Moved by CoolDadTx Tuesday, October 15, 2013 1:44 PM EF related
    Monday, October 14, 2013 12:38 AM

All replies