none
Is it possible to update the data in entity via System.Data.Entity.DbSet entity RRS feed

  • Question

  •  If i want to insert a record in dynamically created entity, i can do something like,

    System.Data.Entity.DbSet entity = Request.Context.Set(obj.GetType());
    Object Updated = entity.Add(obj);

    but if i want to update the record in same entity how can i do that? Please help i am new to EF.

    Monday, January 26, 2015 5:42 AM

Answers

  • Hello Sidra,

    >>but if i want to update the record in same entity how can i do that? Please help i am new to EF.

    If you use the object type, you need to modify its properties by using reflection because at compile time, the type is not known to compiler:

    https://msdn.microsoft.com/en-us/library/axt1ctd9(v=vs.110).aspx

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 27, 2015 9:39 AM
    Moderator