예제 #1
0
        static void Spike3(string[] args)
        {
            using (var cnn = new System.Data.SqlServerCe.SqlCeConnection(@"Data Source=..\..\..\Nespe\App_Data\nespe-ncom.sdf"))
            {
                using (var db = new Nespe.Context.NespeDbContext(cnn, true)) {
                    db.Database.CreateIfNotExists();
                    db.Database.Initialize(true);

                    var drc = db.DepartmentSet;
                    drc.Add(new Models.Department { Name="IT", Description="Information Technologie"});
                    drc.Add(new Models.Department { Name = "IT-Dev", Description = "Information Technologie Development" });
                    drc.Add(new Models.Department { Name = "IT-Infra", Description = "Information Technologie Infrastructures" });
                    db.SaveChanges();
                    var q = (from t in drc select t);
                    foreach (var dr in q) {
                        Console.WriteLine("{0}", dr.Name);
                    }
                }

            }
        }
예제 #2
0
        static void Spike4(string[] args)
        {
            using (var cnn = new System.Data.SqlServerCe.SqlCeConnection(@"Data Source=..\..\..\Nespe\App_Data\nespe-ncom.sdf"))
            {
                using (var db = new Nespe.Context.NespeDbContext(cnn, true))
                {
                    db.Database.CreateIfNotExists();
                    db.Database.Initialize(true);
                    var q = (from t in db.RequestSet select t);
                    foreach (var dr in q)
                    {
                        Console.WriteLine("{0}", dr.Person.FirstName);
                    }
                }

            }
        }