public MapController(IConfiguration config, IHostingEnvironment env, CamnContext context, JDEContext jdeContext) : base(config, env) { var version = context.Layer_Feature_Version.OrderByDescending(t => t.timestamp).FirstOrDefault <LayerFeatureVersion>().Version; _context = context; _jdeContext = jdeContext; _config = config; _domainUrlRoot = _context.Layer_Feature_Version.OrderByDescending(t => t.timestamp).FirstOrDefault <LayerFeatureVersion>().Layer_Feature_Domain; _domainUrl = _context.Layer_Feature_Version.OrderByDescending(t => t.timestamp).FirstOrDefault <LayerFeatureVersion>().Layer_Feature_Domain + version; //Better future implementation to not use config["Host"]?? _proxyDomainUrl = config["Host"].Length > 0 ? config["Host"] + version : _context.Layer_Feature_Version.OrderByDescending(t => t.timestamp).FirstOrDefault <LayerFeatureVersion>().Proxy_Domain + version; }
private void DoWork(object state) { if (!_inMemoryLog.IsEmpty()) { Task.Run(async() => { DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder <CamnContext>(); optionsBuilder.UseSqlServer(_config.GetConnectionString("CamnContextWriter")); CamnContext camnContext = new CamnContext(optionsBuilder.Options); while (!_inMemoryLog.IsEmpty()) { UserAction action = _inMemoryLog.Get(); if (null != action) { await camnContext.UserActions.AddAsync(action); } } await camnContext.SaveChangesAsync(); }).Wait(); } }
public MapViewController(CamnContext camnContext) { _camnContext = camnContext; }