コード例 #1
0
ファイル: UpdateFirstDefect.cs プロジェクト: gourdon/C-
        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);
            }
        }
コード例 #2
0
ファイル: CleanDatabaseSlowly.cs プロジェクト: krwhite/sync
        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();
            }
        }
コード例 #3
0
ファイル: PopulateDatabase.cs プロジェクト: krwhite/sync
        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();
            }
        }