using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Configuration;

namespace BookDemo.QA
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["BookDemoConnectionString"].ToString();
            string[] tables = new string[] { "QAConfig", "QACatalog", "QAUserInfo","QAQuestion" };
            //在程序中启用SQL数据库的缓存依赖项轮询（在数据库中表现为）
            System.Web.Caching.SqlCacheDependencyAdmin.EnableTableForNotifications(connectionString, tables);
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["BookDemoConnectionString"].ToString();
            //在程序中启用通知缓存依赖
            System.Web.Caching.SqlCacheDependencyAdmin.EnableNotifications(connectionString);
        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}