public static void Config(IApplicationBuilder app, IHostApplicationLifetime life) { try { SessionFactoryManager.Initialize <UserMap, User>(Cfg.DB); app.Use <Orm>(async(context, next) => { if (context.IsAsset()) { return; } SessionManager.Init( () => Session.GetKey(() => context) ); await next(); SessionManager.Close(); }); life.ApplicationStopping.Register(SessionFactoryManager.End); } catch (Exception e) { e.TryLogHandled("Error on initialize DB"); } }
private static void sessionFactory(Action action) { SessionFactoryManager.Initialize <UserMap, User>(Cfg.DB); try { action(); } finally { SessionFactoryManager.End(); } }
public static void Start() { Cfg.Init(); setLogName(); setRepositories(); log("General", "BeforeTestRun"); TZ.Init(false); ControlMap.IsTest = true; SessionFactoryManager.Initialize <UserMap, User>(Cfg.DB); SessionManager.Init(getTicketKey); service = new ServiceAccess(getTicket, getSite); PlainText.Initialize(runPath); }