コード例 #1
0
        static void Import(string simAreasPath, DbConnection connection)
        {
            var simarea = new SimAreasContext(connection, false, new DropCreateDatabaseAlways<SimAreasContext>());
            var engine = new FileHelperEngine(typeof(SimAreas));
            var entries = (SimAreas[])engine.ReadFile(simAreasPath);

            foreach (var entry in entries)
            {
                var area = (from s in simarea.SimAreas
                            where s.SimAreaName == entry.SimAreaName
                            select s).FirstOrDefault();
                if (area == null)
                {
                    area = new SimArea
                    {
                        SimAreaName = entry.SimAreaName,
                        Latitude = entry.Latitude,
                        Longitude = entry.Longitude,
                        Height = entry.Height,
                        GeoidSeparation = entry.GeoidSeparation,
                        OpsLimitFile = entry.OpsLimitFile,
                        SimLimitFile = entry.SimLimitFile,
                    };
                    simarea.SimAreas.Add(area);
                    simarea.SaveChanges();
                }

            }
        }
コード例 #2
0
 static void Dump(DbConnection connection)
 {
     var simareas = new SimAreasContext(connection, true, new CreateDatabaseIfNotExists<SimAreasContext>());
     foreach (var area in simareas.SimAreas)
     {
         Console.WriteLine("{0} {1} {2}", area.SimAreaName, area.Latitude, area.Longitude);
     }
 }