示例#1
0
 private NavigationService()
 {
     context = new DB();
     context.Configuration.AutoDetectChangesEnabled = false;
     context.Configuration.ProxyCreationEnabled = false;
     context.Configuration.ValidateOnSaveEnabled = false;
 }
示例#2
0
文件: DB.cs 项目: reisergames/evenav
        private StaticDB()
        {
            SolarSystems = new List<SolarSystem>();
            Regions = new List<Region>();
            Denormalized = new List<Denormalize>();
            using (var context = new DB())
            {
                context.Configuration.LazyLoadingEnabled = false;
                context.Configuration.ProxyCreationEnabled = false;
                context.Configuration.AutoDetectChangesEnabled = false;

                var systems = (from s in context.SolarSystems
                              select s).ToList();

                foreach(var system in systems)
                {
                    SolarSystems.Add(system);
                }
                systems = null;

                var regions = (from s in context.Regions
                              select s).ToList();

                foreach (var s in regions)
                {
                    Regions.Add(s);
                }
                systems = null;

                var locations = (from s in context.Denormalized
                        select s).ToList();

                foreach (var l in locations)
                {
                    Denormalized.Add(l);
                }
                locations = null;
            }
        }