Пример #1
0
        private static void Spike_NespeDataContext_Department_List(string[] args)
        {
            using (var ctx = new Nespe.Data.Context.NespeDataContext())
            {
                foreach (var dp in ctx.DepartmentSet)
                {
                    Console.WriteLine(dp);
                };

            }
        }
Пример #2
0
 static void Spike_InitialContext(string[] args)
 {
     using (var ctx = new Nespe.Data.Context.NespeDataContext())
     {
         ctx.Database.CreateIfNotExists();
         ctx.DepartmentSet.Add(
             new Department
             {
                 Name = "IT",
                 Description = " Information Technologies",
                 PersonList = new List<PersonDepartment> {
                     new PersonDepartment{
                         Person=new Person{
                             FirstName="Martin", LastName="Airas"
                         },
                         Role=PersonDepartmentRoleEnum.Head
                     }
                 }
             }
           );
         ctx.PersonDepartmentSet.Add(
             new PersonDepartment
             {
                 Role = PersonDepartmentRoleEnum.Head,
                 Person = new Person
                 {
                     FirstName = "Martin",
                     LastName = "Airas"
                 },
                 Department = new Department
                 {
                     Name = "IT",
                     Description = " Information Technologies"
                 }
             });
         ctx.SaveChanges();
         foreach (var dp in ctx.DepartmentSet) {
             Console.WriteLine(dp);
         };
     }
 }
Пример #3
0
 static void Spike_NespeDataContext_ExternalConnection_Owned(string[] args)
 {
     var cs = System.Configuration.ConfigurationManager.ConnectionStrings["NespeDataContext"];
     using (var cnn = new System.Data.SqlServerCe.SqlCeConnection(cs.ConnectionString))
     {
         using (var ctx = new Nespe.Data.Context.NespeDataContext(cnn, true))
         {
             ctx.Database.CreateIfNotExists();
             foreach (var dp in ctx.DepartmentSet)
             {
                 Console.WriteLine(dp);
             };
         }
     }
 }
Пример #4
0
        private static void Spike_NespeDataContext_PersonTaskRequest_List(string[] args)
        {
            using (var ctx = new Nespe.Data.Context.NespeDataContext())
            {
                foreach (var dp in ctx.PersonTaskRequestSet)
                {
                    Console.WriteLine(dp);
                };

            }
        }