namespace MyApp.Web.Models { using System; using System.Collections.Generic; using System.Data.Linq; public partial class MyAppDataContext { public bool DeleteAllOnSubmit(IEnumerable entities) { try { GetTable(typeof(T)).DeleteAllOnSubmit(entities); SubmitChanges(); return true; } catch (Exception) { return false; } } public bool DeleteOnSubmit(T entity) { try { GetTable(typeof(T)).DeleteOnSubmit(entity); SubmitChanges(); return true; } catch (Exception) { return false; } } public bool InsertAllOnSubmit(IEnumerable entities) { try { GetTable(typeof(T)).InsertAllOnSubmit(entities); SubmitChanges(); return true; } catch (Exception) { return false; } } public bool InsertOnSubmit(ref T entity) { try { GetTable(typeof(T)).InsertOnSubmit(entity); SubmitChanges(); return true; } catch (Exception) { return false; } } partial void OnCreated() { var options = new DataLoadOptions(); // Add loadwith elements // options.LoadWith(p => p.columnName); LoadOptions = options; } } }