public static void Init(EcoContext context) { Console.WriteLine("Hello World!"); ResourceTypes.Init(); var op = new Region(true); var op2 = new Region(false); var regions = new List <Region>(); regions.Add(op); regions.Add(op2); context.Region.Add(op); context.Region.Add(op2); //op.Connect(op2); //int iter = 0; //while (true) //{ // Console.WriteLine("------------------------New gen------------------------------------" + iter++); // regions.ForEach(re => re.Update()); // regions.ForEach(re => re.CleanUp()); // System.Threading.Thread.Sleep(10); //} }
public OrderFunctions(IFirebaseTokenProvider provider, EcoContext context, IRepository <EcoItem> ecoItemRepo, IRepository <Cart> cartRepo, IRepository <Transaction> transRepo) : base(provider) { this.Context = context; this.IEcoItemRepo = ecoItemRepo; this.ITransRepo = transRepo; this.ICartRepo = cartRepo; }
public static void CleanUp(EcoContext context) { IQueryable <TradingResource> tr = context.TradingResource.Where(r => r.TradingResourcesID == null && r.ExternalTradingResourcesID == null); context.Destination.RemoveRange(context.Destination.Where(dr => dr.ExternatlTradingResource == null)); context.TradingResource.RemoveRange(tr); //context.Destination.RemoveRange(context.Destination.Where(d => d.DaysRemaning <= 0)); }
public ItemFunctions(IFirebaseTokenProvider provider, EcoContext context, IRepository <EcoItem> ecoItemRepo, IRepository <CraftType> craftTypeRepo, IRepository <SupplyType> supplyType) : base(provider) { this.Context = context; this.IEcoItemRepo = ecoItemRepo; this.ICraftTypeRepo = craftTypeRepo; this.ISupplyType = supplyType; }
public SampleDataController(EcoContext context) { this.context = context; context.Database.EnsureDeleted(); context.Database.EnsureCreated(); Init(context); context.SaveChanges(); }
public MapController(EcoContext context, ContryService contryService, PopulationService populationService, ResourceService resourceService) { Context = context; ContryService = contryService; PopulationService = populationService; ResourceService = resourceService; string CultureName = Thread.CurrentThread.CurrentCulture.Name; CultureInfo ci = new CultureInfo(CultureName); if (ci.NumberFormat.NumberDecimalSeparator != ".") { // Forcing use of decimal separator for numerical values ci.NumberFormat.NumberDecimalSeparator = "."; Thread.CurrentThread.CurrentCulture = ci; } }
public static void Init(IServiceProvider service) { Init(); using var serviceScope = service.CreateScope(); var scopeServiceProvider = serviceScope.ServiceProvider; EcoContext context = scopeServiceProvider.GetService <EcoContext>(); var sw = new Stopwatch(); double time = 0; int iter = 0; sw.Start(); int frameTime = 100; // context.ChangeTracker.ValidateOnSaveEnabled = false; while (true) { double startTime = sw.Elapsed.TotalMilliseconds; context.ChangeTracker.AutoDetectChangesEnabled = false; IEnumerable <Contry> contries = context.Contry; Console.WriteLine("------------------------New gen------------------------------------" + iter++); foreach (Contry contry in contries) { contry.Update(); } Console.WriteLine("Elapsed Compute ={0}", sw.Elapsed.TotalMilliseconds - time); time = sw.Elapsed.TotalMilliseconds; context.ChangeTracker.AutoDetectChangesEnabled = true; CleanUp(context); context.BulkSaveChanges(); Console.WriteLine("Elapsed Commit ={0}", sw.Elapsed.TotalMilliseconds - time); Thread.Sleep((int)Math.Max(1, frameTime - (sw.Elapsed.TotalMilliseconds - startTime))); time = sw.Elapsed.TotalMilliseconds; } }
public AuthFunctions(IFirebaseTokenProvider provider, EcoContext context, IRepository <User> userRepo) : base(provider) { this.Context = context; this.IUserRepo = userRepo; }
public PopulationService(EcoContext context) { Context = context; }
public ContryService(EcoContext context) { Context = context; }
public DomainRepo(EcoContext context, DbSet <T> dbSet) { Table = dbSet; Context = context; }
public ResourceService(EcoContext context) { Context = context; }