I have a database context with multiple database set. I have an edit (httpget) and an edit (httppost) method. I want to save specific data in specific datasets. How can I specify which database set I want to use? BTW, the view from of the Edit method uses several models.
My database context looks like this:
public class mycontext :DBContext
{
public DBSet<Table1> table1{get; set;}
public DBSet<Table2> table2{get; set;}
public DBSet<Table3> table3{get; set;}
}
When I define
private mycontext data = new mycontext()
The only option is data.SaveChanges(). I want to so something like
data.table1.SaveChanges() and pass in the data I want to save.
DbContextin Entity Framework is that it keep track of the changes itself, and saves out whatever is needed, all in one transaction, when you call.SaveChanges()on it. You cannot just save half the changes, on one table - all the changes you've made to the context will be saved - all at once