Global.asax 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <%@ Application Language="C#" %>
  2. <%@ Import Namespace="Castle.ActiveRecord" %>
  3. <%@ Import Namespace="Castle.ActiveRecord.Framework.Config" %>
  4. <%@ Import Namespace="BizCom" %>
  5. <%@ Import Namespace="Utils" %>
  6. <%@ Import Namespace="System.Threading" %>
  7. <script RunAt="server">
  8. System.Threading.Timer gtimer;
  9. void Application_Start(object sender, EventArgs e)
  10. {
  11. //log4net.Config.XmlConfigurator.Configure();
  12. // Code that runs on application startup
  13. InPlaceConfigurationSource source = new InPlaceConfigurationSource();
  14. System.Collections.Generic.IDictionary<string, string> properties = new System.Collections.Generic.Dictionary<string, string>();
  15. properties.Add("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
  16. properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle");
  17. properties.Add("dialect", "NHibernate.Dialect.MsSql2005Dialect");
  18. properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
  19. string conn = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
  20. properties.Add("connection.connection_string", SecurityHelper.DecryptSymmetric(conn));
  21. source.Add(typeof(ActiveRecordBase), properties);
  22. source.IsRunningInWebApp = true;
  23. //IConfigurationSource source =ConfigurationManager.GetSection("activerecord") as IConfigurationSource;
  24. Type[] acTypes = new[]
  25. {
  26. typeof(CeErpTrade),
  27. typeof(CeErpTradeCell),
  28. typeof(XLog),
  29. typeof(CeErpTradeLog),
  30. typeof(CeErpProduct),
  31. typeof(CeErpDataSendOrderInfo),
  32. };
  33. ActiveRecordStarter.Initialize(source, acTypes);
  34. }
  35. void global_elapsed(object state)
  36. {
  37. }
  38. void Application_End(object sender, EventArgs e)
  39. {
  40. // Code that runs on application shutdown
  41. }
  42. void Application_BeginRequest(Object sender, EventArgs e)
  43. {
  44. }
  45. void Application_Error(object sender, EventArgs e)
  46. {
  47. // Code that runs when an unhandled error occurs
  48. //if (config.Instance.Site.SpiderIp.Contains(CommonHelper.ClientIP))return;
  49. //SyLog.WriteLog(Server.GetLastError());
  50. }
  51. void Session_Start(object sender, EventArgs e)
  52. {
  53. // Code that runs when a new session is started
  54. }
  55. void Session_End(object sender, EventArgs e)
  56. {
  57. // Code that runs when a session ends.
  58. // Note: The Session_End event is raised only when the sessionstate mode
  59. // is set to InProc in the Web.config file. If session mode is set to StateServer
  60. // or SQLServer, the event is not raised.
  61. }
  62. </script>