I have this repeating method in my classes (some lines have been removed to simplify the question):
public void CreateNew(DBContext db, SystemMessageReport newRec)
{
db.SystemMessageReports.InsertOnSubmit(newRec);
db.SubmitChanges();
}
Ideally, I'd like to be able to move this method to it's parent class as a generic method.
If SystemMessageReport
is passed as T
, is it possible to InsertOnSubmit
to it's correspdonding Linq Table
? For example:
public void CreateNew<T>(DBContext db, T newRec)
{
db.T.InsertOnSubmit(newRec);
db.SubmitChanges();
}
Aucun commentaire:
Enregistrer un commentaire