1- using System ;
2- using System . Collections . Generic ;
3- using System . Linq ;
4- using System . Web ;
5- using System . Web . Security ;
6- using System . Web . SessionState ;
7-
8- namespace Ignia . Topics . Web . Host
9- {
10- public class Global : System . Web . HttpApplication
11- {
12- protected void Application_Start ( object sender , EventArgs e )
13- {
14- }
1+ /*==============================================================================================================================
2+ | Author Ignia, LLC
3+ | Client Ignia, LLC
4+ | Project OnTopicSample OnTopic Site
5+ \=============================================================================================================================*/
6+ using System ;
7+ using System . Configuration ;
8+ using System . Web . Routing ;
9+ using Ignia . Topics . Data . Caching ;
10+ using Ignia . Topics . Data . Sql ;
11+
12+ namespace Ignia . Topics . Web . Host {
13+
14+ /*============================================================================================================================
15+ | CLASS: GLOBAL
16+ \---------------------------------------------------------------------------------------------------------------------------*/
17+ /// <summary>
18+ /// Provides default configuration for the application, including any special processing that needs to happen relative to
19+ /// application events (such as <see cref="Application_Start"/> or <see cref="System.Web.HttpApplication.Error"/>.
20+ /// </summary>
21+ public class Global : System . Web . HttpApplication {
22+
23+ /*==========================================================================================================================
24+ | EVENT: APPLICATION START
25+ >===========================================================================================================================
26+ | Runs once when the first page of your application is run for the first time by any user
27+ \-------------------------------------------------------------------------------------------------------------------------*/
28+ [ Obsolete ]
29+ protected void Application_Start ( object sender , EventArgs e ) {
30+
31+ /*------------------------------------------------------------------------------------------------------------------------
32+ | ESTABLISH ERROR TRACKING VARIABLES
33+ \-----------------------------------------------------------------------------------------------------------------------*/
34+ Application [ "Debug" ] = false ;
35+ Application [ "ErrorTime" ] = DateTime . Now ;
36+ Application [ "ErrorCount" ] = 0 ;
37+
38+ /*------------------------------------------------------------------------------------------------------------------------
39+ | CONFIGURE REPOSITORY
40+ \-----------------------------------------------------------------------------------------------------------------------*/
41+ var connectionString = ConfigurationManager . ConnectionStrings [ "OnTopic" ] . ConnectionString ;
42+ var sqlTopicRepository = new SqlTopicRepository ( connectionString ) ;
43+ var topicRepository = new CachedTopicRepository ( sqlTopicRepository ) ;
44+
45+ TopicRepository . DataProvider = topicRepository ;
46+
47+ /*------------------------------------------------------------------------------------------------------------------------
48+ | REGISTER ROUTES
49+ \-----------------------------------------------------------------------------------------------------------------------*/
50+ RegisterRoutes ( RouteTable . Routes ) ;
51+
1552 }
16- }
53+
54+ /*==========================================================================================================================
55+ | METHOD: REGISTER ROUTES
56+ >===========================================================================================================================
57+ | Establishes URL routes and maps them to the appropriate page handlers.
58+ \-------------------------------------------------------------------------------------------------------------------------*/
59+ void RegisterRoutes ( RouteCollection routes ) {
60+ routes . Add (
61+ "TopicUrl" ,
62+ new Route (
63+ "{rootTopic}/{*path}" ,
64+ new TopicsRouteHandler ( )
65+ )
66+ ) ;
67+ }
68+
69+ } //Class
70+ } //Namespace
0 commit comments