jeudi 25 août 2016

Insert record to the table using entity framework

I have an Entity DbContext object which has a table called 'Employees'. I have employee object which I want to insert to Employees tables. I cannot use the Employees directly from the context. Want to access with the table name. is this possible ?

 MyContext _ctx;
 Type employee = a.GetType("SC.Employee"));
 object employee =Newtonsoft.Json.JsonConvert.DeserializeObject(emp, employee);
 using (_ctx=new MyContext())
 {
     //I am trying to insert the employee object to my entity. But this doesn't work
     //_customCtx.Employees.add(employee)
 }





Aucun commentaire:

Enregistrer un commentaire