using System;
using System.Web;
using System.Web.Hosting;
using UMinho.Framework.Web.UI;
using UMinho.GestaoProjectos;

namespace UMinho.GestaoProjetosWeb
{
    public class Global : HttpApplication
    {
        void Application_Start(object sender, EventArgs e)
        {
            AssemblyResourceProvider vpp = new AssemblyResourceProvider("MasterPageWebResource");
            HostingEnvironment.RegisterVirtualPathProvider(vpp);

            //HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
        }

        void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown

        }

        void Application_Error(object sender, EventArgs e)
        {
            Exception ex;
            if (Server.GetLastError().InnerException != null)
            {
                ex = Server.GetLastError().InnerException;
            }
            else
            {
                ex = Server.GetLastError();
            }

            BLLLogger.LogError(ex, (HttpContext.Current.Handler as UMinho.Framework.Web.UI.BasePortalPage).CurrentUserLogin);

        }
    }
}
