示例#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
 protected static void SetRuntime(HttpApplication application, IRuntime runtime)
 {
     StatisticsApplication.SetRuntime(application.Application, runtime);
 }
示例#3
0
 protected static void SetRuntime(HttpContext context, IRuntime runtime)
 {
     StatisticsApplication.SetRuntime(context.Application, runtime);
 }