예제 #1
0
        protected virtual void InitializeRuntime()
        {
            if (StatisticsApplication.HasRuntime(this))
            {
                return;
            }

            lock (MobiHttpApplicationInitializeRuntimeLockObject)
            {
                //string name = HostingEnvironment.SiteName;
                if (StatisticsApplication.HasRuntime(this))
                {
                    return;
                }

                Data.Application application = MobiChat.Data.Application.CreateManager().Load(HostingEnvironment.SiteName);

                // SUMMARY: for testing from local
                if (application == null && HostingEnvironment.SiteName.Equals("MobiChat.Statistics"))
                {
                    application = MobiChat.Data.Application.CreateManager().Load(5);
                }
                if (application == null)
                {
                    //Log.Fatal(string.Format("Application {0} is not loaded.", HostingEnvironment.SiteName));
                    throw new InvalidOperationException(string.Format("No application with name '{0}' registered in database.", HostingEnvironment.SiteName));
                }

                this._baseApplication = new ApplicationBase(application);

                IRuntime runtime = this._baseApplication.ApplicationData.InstantiateRuntime();
                if (!runtime.Initialize(HostingEnvironment.SiteName))
                {
                    return;
                }

                StatisticsApplication.SetRuntime(this, runtime);

                Log.Debug(string.Format("Application {0} initialized!", HostingEnvironment.SiteName));
                this.InitializeApplication();
            }

            return;
        }
예제 #2
0
 public static bool HasRuntime(HttpApplication application)
 {
     return(StatisticsApplication.HasRuntime(application.Application));
 }
예제 #3
0
 public static bool HasRuntime(HttpContext context)
 {
     return(StatisticsApplication.HasRuntime(context.Application));
 }