I am trying to learn LINQ to SQL, and I can query the database and return IQueryable and process the objects that I extract from this. But I do not know how to add a new object back to the database or to the original IQueryable.
private DataContext db;
private IQueryable<ActionType> action;
public void BuildQuery(string connection) {
db = new DataContext(connection);
action = db.GetTable<ActionType>().Select(a=>a);
ActionType at = new ActionType();
at.Name = "New Action Type";
}
It is surprisingly hard to find if you do not know the right conditions. And I cannot find examples that do exactly what I want them to do.
So, how do I add adding new objects to a query / database?
source
share