static void Main() { using (var context = new DefectModelDataContext()) { context.Log = Console.Out; Defect defect = context.Defects .Where(d => d.ID==1) .Single(); User tim = defect.CreatedBy; defect.AssignedTo = tim; tim.Name = "Timothy Trotter"; defect.Status = Status.Fixed; defect.LastModified = SampleData.May(31); context.SubmitChanges(); } using (var context = new DefectModelDataContext()) { Defect d = (from defect in context.Defects where defect.ID==1 select defect).Single(); Console.WriteLine (d); } }
static void Main() { using (var context = new DefectModelDataContext()) { context.Log = Console.Out; context.NotificationSubscriptions.DeleteAllOnSubmit(from subscription in context.NotificationSubscriptions select subscription); context.Projects.DeleteAllOnSubmit(from project in context.Projects select project); context.Defects.DeleteAllOnSubmit(from defect in context.Defects select defect); context.Users.DeleteAllOnSubmit(from user in context.Users select user); context.SubmitChanges(); } }
static void Main() { using (var context = new DefectModelDataContext()) { context.Log = Console.Out; context.Defects.InsertAllOnSubmit(SampleData.AllDefects); context.NotificationSubscriptions.InsertAllOnSubmit(SampleData.AllSubscriptions); context.Users.InsertAllOnSubmit(SampleData.AllUsers); context.Projects.InsertAllOnSubmit(SampleData.AllProjects); context.SubmitChanges(); } }