/// <summary> /// Due to issues on IIS7, the NHibernate initialization cannot reside in Init() but /// must only be called once. Consequently, we invoke a thread-safe singleton class to /// ensure it's only initialized once. /// </summary> protected void Application_BeginRequest(object sender, EventArgs e) { NHibernateInitializer.Instance().InitializeNHibernateOnce(this.InitializeNHibernateSession); System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ru-RU"); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ru-RU"); }
protected override void OnStart(string[] args) { storage = new WcfSessionStorage(); log4net.Config.XmlConfigurator.Configure(); // Create container IWindsorContainer container = new WindsorContainer(); // Add Engine for the Host Service container.AddComponent("outfitEngineService", typeof(OutfitEngineService)); container.AddComponent("outfitUpdaterService", typeof(OutfitUpdaterService)); // Add the Services to the Container ComponentRegistrar.AddServicesTo(container); ComponentRegistrar.AddApplicationServicesTo(container); // Create the container ServiceLocatorInitializer.Init(container); // Initialize NHibernate NHibernateInitializer.Instance().InitializeNHibernateOnce( () => InitializeNHibernateSession()); // Create Service Host host = new System.ServiceModel.ServiceHost(typeof(OutfitEngineService)); host.Description.Behaviors.Add(new PerCallServiceBehavior()); host.Open(); hostUpdater = new SharpArch.Wcf.NHibernate.ServiceHost(typeof(OutfitUpdaterService)); hostUpdater.Open(); }
/// <summary> /// The Application_BeginRequest function /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Application_BeginRequest(Object sender, EventArgs e) { CmsContext.Application_BeginRequest(Context); NHibernateInitializer.Instance().InitializeNHibernateOnce(delegate { InitializeNHibernateSession(); }); }
public virtual void Application_Start() { InitProjectHierarchy(); InitLog4net(); InitializeServiceLocator(); InitAutoMapper(); InitOther(); NHibernateInitializer.Instance().InitializeNHibernateOnce(this.InitialiseNHibernateSessions); }
/// <summary> /// Due to issues on IIS7, the NHibernate initialization cannot reside in Init() but /// must only be called once. Consequently, we invoke a thread-safe singleton class to /// ensure it's only initialized once. /// </summary> protected void Application_BeginRequest(object sender, EventArgs e) { NHibernateInitializer.Instance().InitializeNHibernateOnce( () => InitializeNHibernateSession()); Repository <AppConfig> appConfigRepository = new Repository <AppConfig>(); AppConfig appConfig = appConfigRepository.Get(1); Application["AppTitle"] = appConfig.Title; }
protected void Application_BeginRequest(object sender, EventArgs e) { // Only initialise the NHibernate Sessions for a non static, i.e. Controller Action request if (!this.Request.IsStaticFile()) { NHibernateInitializer.Instance().InitializeNHibernateOnce(this.InitialiseNHibernateSessions); } Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB"); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); }
/// <summary> /// Due to issues on IIS7, the NHibernate initialization cannot reside in Init() but /// must only be called once. Consequently, we invoke a thread-safe singleton class to /// ensure it's only initialized once. /// </summary> protected void Application_BeginRequest(object sender, EventArgs e) { NHibernateInitializer.Instance().InitializeNHibernateOnce( () => InitializeNHibernateSession()); HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)); HttpContext.Current.Response.Cache.SetValidUntilExpires(false); HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); HttpContext.Current.Response.Cache.SetNoStore(); }
protected void Application_BeginRequest(object sender, EventArgs e) { NHibernateInitializer.Instance().InitializeNHibernateOnce(this.InitialiseNHibernateSessions); if (Request.IsLocal) { // don't enable MiniProfiler for scheduled actions, which are called locally. if (Request.Path.IndexOf("Scheduled") < 0) { MiniProfiler.Start(); MiniProfiler.Settings.MaxJsonResponseSize = 2147483647; } } }
/// <summary> /// Due to issues on IIS7, the NHibernate initialization cannot reside in Init() but /// must only be called once. Consequently, we invoke a thread-safe singleton class to /// ensure it's only initialized once. /// </summary> protected void Application_BeginRequest(object sender, EventArgs e) { NHibernateInitializer.Instance().InitializeNHibernateOnce(InitializeNHibernateSession); const string authParamName = "token"; if (HttpContext.Current.Request.Form[authParamName] == null) { return; } // required for uploading files var authCookieName = FormsAuthentication.FormsCookieName; UpdateCookie(authCookieName, HttpContext.Current.Request.Form[authParamName]); }
/// <summary> /// Updates all feeds. /// Normally executed on weekends. /// </summary> /// <remarks> /// Example of usage: /// FashionAde.OutfitUpdaterExecutor.exe host username password file1 file2 ... fileN /// FashionAde.OutfitUpdaterExecutor.exe /download aftp.linksynergy.com jfennell2753 KftEapMS 24895_2389515_mp.txt.gz 13816_2389515_mp.txt.gz /// FashionAde.OutfitUpdaterExecutor.exe /download datatransfer.cj.com 2805067 CyWm5fUc /outgoing/productcatalog/52470/Zappos_com-Product_Catalog_1.txt.gz /// FashionAde.OutfitUpdaterExecutor.exe /execute /// </remarks> /// <param name="args"></param> static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); // Create container IWindsorContainer container = new WindsorContainer(); // Add the Services to the Container ComponentRegistrar.AddApplicationServicesTo(container); // Create the container ServiceLocatorInitializer.Init(container); // Initialize NHibernate NHibernateInitializer.Instance().InitializeNHibernateOnce( InitializeNHibernateSession); try { if (args.Length > 4 && args[0].ToLower() == Download) { // Download Files From Ftp string host = args[1]; // "aftp.linksynergy.com"; string userName = args[2]; // "jfennell2753"; string password = args[3]; // "KftEapMS"; for (var i = 4; i < args.Length; i++) { string sourceFile = args[i]; DownloadFile(host, userName, password, sourceFile); } } else if (args.Length == 1 && args[0].ToLower() == Execute) { // Start executing the updater new OutfitUpdaterReference.OutfitUpdaterServiceClient().UpdateFeeds(); } else if (args.Length == 1 && args[0].ToLower() == CreateIndexes) { IIndexCreationService ics = ServiceLocator.Current.GetInstance <IIndexCreationService>(); ics.CreateIndexes(); } } catch (Exception ex) { Log.Error(ex); } }
protected void Application_BeginRequest(object sender, EventArgs e) { try { string session_param_name = "ASPSESSID"; string session_cookie_name = "ASP.NET_SESSIONID"; if (HttpContext.Current.Request.Form[session_param_name] != null) { UpdateCookie(session_cookie_name, HttpContext.Current.Request.Form[session_param_name]); } else if (HttpContext.Current.Request.QueryString[session_param_name] != null) { UpdateCookie(session_cookie_name, HttpContext.Current.Request.QueryString[session_param_name]); } } catch (Exception) { Response.StatusCode = 500; Response.Write("Error Initializing Session"); } try { string auth_param_name = "AUTHID"; string auth_cookie_name = FormsAuthentication.FormsCookieName; if (HttpContext.Current.Request.Form[auth_param_name] != null) { UpdateCookie(auth_cookie_name, HttpContext.Current.Request.Form[auth_param_name]); } else if (HttpContext.Current.Request.QueryString[auth_param_name] != null) { UpdateCookie(auth_cookie_name, HttpContext.Current.Request.QueryString[auth_param_name]); } } catch (Exception) { Response.StatusCode = 500; Response.Write("Error Initializing Forms Authentication"); } NHibernateInitializer.Instance().InitializeNHibernateOnce(this.InitialiseNHibernateSessions); }
static void Main(string[] args) { try { log4net.Config.XmlConfigurator.Configure(); // Create container IWindsorContainer container = new WindsorContainer(); // Add Engine for the Host Service container.AddComponent("outfitEngineService", typeof(OutfitEngineService)); container.AddComponent("outfitUpdaterService", typeof(OutfitUpdaterService)); // Add the Services to the Container ComponentRegistrar.AddServicesTo(container); ComponentRegistrar.AddApplicationServicesTo(container); // Create the container ServiceLocatorInitializer.Init(container); // Initialize NHibernate NHibernateInitializer.Instance().InitializeNHibernateOnce( () => InitializeNHibernateSession()); System.ServiceModel.ServiceHost host = new System.ServiceModel.ServiceHost(typeof(OutfitEngineService)); host.Description.Behaviors.Add(new PerCallServiceBehavior()); host.Open(); ServiceHost host2 = new ServiceHost(typeof(OutfitUpdaterService)); host2.Open(); Console.WriteLine("Service started..."); Console.ReadLine(); host.Close(); host2.Close(); Console.WriteLine("Service stopped..."); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void Main(string[] args) { Aplicacao.Boot(); string[] mappings = new string[] { Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Salus.Infra.dll") }; NHibernateInitializer.Instance().InitializeNHibernateOnce(() => { NHibernateSession.Init( new ThreadSessionStorage(), mappings, null, null, null, null, BancoDeDados.Configuration()); }); var fluentConfiguration = Fluently.Configure() .Database(BancoDeDados.Configuration()) .Mappings(m => { m.FluentMappings.Conventions.Add <EnumConvention>(); m.FluentMappings.Conventions.Add <EnumerationTypeConvention>(); }); comandos.Add( "schema update", () => InversionControl.Current.Resolve <SchemaUpdateTask>()); comandos.Add( "import data", () => InversionControl.Current.Resolve <SalusImportDatabaseTask>()); comandos.Add( "import storage", () => InversionControl.Current.Resolve <SalusImportStorageTask>()); ExecutarTarefa(args); }
private void BeginRequest(object sender, EventArgs e) { string[] mappings = new string[] { Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin", "Salus.Infra.dll") }; NHibernateInitializer.Instance().InitializeNHibernateOnce(() => { NHibernateSession.Init( new ThreadSessionStorage(), mappings, null, null, null, null, BancoDeDados.Configuration()); }); var fluentConfiguration = Fluently.Configure() .Database(BancoDeDados.Configuration()) .Mappings(m => { m.FluentMappings.Conventions.Add <EnumConvention>(); m.FluentMappings.Conventions.Add <EnumerationTypeConvention>(); }); }
static void Main(string[] args) { try { // Create the container IWindsorContainer container = new WindsorContainer(); // Initialize NHibernate NHibernateInitializer.Instance().InitializeNHibernateOnce( () => InitializeNHibernateSession()); GC.Collect(); OUImportationController temp = new OUImportationController(new ZapposClassBuilder(), new OutfitUpdaterRepository(), new TrendRepository()); //OUImportationController temp = new OUImportationController(new ZapposClassBuilder(), null, null); temp.HaveHeader = true; if (args[0].ToLower() == "false") { temp.HaveHeader = false; } temp.Separator = args[1]; temp.Path = args[2]; temp.Filename = args[3]; if (args[4].ToLower() == "false") { temp.Sync = false; } temp.MemorySafe = Convert.ToDouble(args[5]); temp.Create(); GC.Collect(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
protected void Application_BeginRequest(object sender, EventArgs e) { NHibernateInitializer.Instance().InitializeNHibernateOnce(this.InitialiseNHibernateSessions); }
public override void Init() { _webSessionStorage = new WebSessionStorage(this); base.Init(); NHibernateInitializer.Instance().InitializeNHibernateOnce(InitializeNHibernateSession); }
public static void Initialize(HttpApplication app, WebSessionStorage storage) { NHibernateInitializer.Instance().InitializeNHibernateOnce(new NHibernateInitializerConfig(app, storage).InitialiseNHibernateSessions); }