public ApiV2Controller() { _logger = ServiceLocator.Current.GetService <ILogger>(); _host = ServiceLocator.Current.GetService <IApplicationHost>(); _dbContext = ServiceLocator.Current.GetService <IDbContext>(); _host.StartApplication(false); _host.Profiler.Enabled = false; }
public AccountController() { // DI ready var serviceLocator = ServiceLocator.Current; _host = serviceLocator.GetService <IApplicationHost>(); _dbContext = serviceLocator.GetService <IDbContext>(); _localizer = serviceLocator.GetService <ILocalizer>(); _host.StartApplication(false); }
public ServerValidate() { TestConfig.Start(); var loc = ServiceLocator.Current; _dbContext = loc.GetService <IDbContext>(); _localizer = loc.GetService <ILocalizer>(); _host = loc.GetService <IApplicationHost>(); _host.StartApplication(false); }
public AccountController(AppUserManager userManager, AppSignInManager signInManager) : base(userManager, signInManager) { // DI ready var serviceLocator = ServiceLocator.Current; _host = serviceLocator.GetService <IApplicationHost>(); _dbContext = serviceLocator.GetService <IDbContext>(); _localizer = serviceLocator.GetService <ILocalizer>(); _host.StartApplication(false); }
public AppLinkController() { // DI ready var serviceLocator = ServiceLocator.Current; _host = serviceLocator.GetService <IApplicationHost>(); _dbContext = serviceLocator.GetService <IDbContext>(); _localizer = serviceLocator.GetService <ILocalizer>(); _baseController = new A2v10.Request.BaseController(); _host.StartApplication(false); }
public AccountController() { // DI ready var serviceLocator = ServiceLocator.Current; _host = serviceLocator.GetService <IApplicationHost>(); _dbContext = serviceLocator.GetService <IDbContext>(); _localizer = serviceLocator.GetService <ILocalizer>(); _userStateManager = serviceLocator.GetService <IUserStateManager>(); _userLocale = serviceLocator.GetService <IUserLocale>(); _dataProtectionProvider = serviceLocator.GetService <IDataProtectionProvider>(); _host.StartApplication(false); }
static void Main(String[] args) { BackgroundTasksManager _manager = null; try { var defaultCulture = ConfigurationManager.AppSettings["defaultCulture"]; if (defaultCulture != null) { var cultureInfo = new CultureInfo(defaultCulture); CultureInfo.DefaultThreadCurrentCulture = cultureInfo; CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; } StartServices(); var loc = ServiceLocator.Current; ILogger logger = loc.GetService <ILogger>(); IDbContext dbContext = loc.GetService <IDbContext>(); IApplicationHost host = loc.GetService <IApplicationHost>(); IMessaging messaging = loc.GetService <IMessaging>(); Console.WriteLine("Service started"); _manager = new BackgroundTasksManager(host, dbContext, logger, messaging); logger.LogBackground($"CurrentCulutre: {Thread.CurrentThread.CurrentCulture}"); host.StartApplication(false); _manager.Start(); _manager.StartTasksFromConfig(); Console.WriteLine("Press any key to stop service..."); Console.Read(); _manager.Stop(); } catch (Exception ex) { if (ex.InnerException != null) { ex = ex.InnerException; } Console.WriteLine(ex.Message); _manager?.Stop(); } }