Skip to content

Commit df0637c

Browse files
committed
Introduced basic configuration for **OnTopic**
This won't render any pages, but ensures that the basic configuration is in place, including connection strings, assemblies, referenced namespaces, and routes.
1 parent 63edb64 commit df0637c

File tree

4 files changed

+111
-22
lines changed

4 files changed

+111
-22
lines changed
Lines changed: 69 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,70 @@
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

Ignia.Topics.Web.Host/Ignia.Topics.Web.Host.csproj

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
</PropertyGroup>
4545
<ItemGroup>
4646
<Reference Include="Microsoft.CSharp" />
47+
<Reference Include="System.Data.SqlClient, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
48+
<HintPath>..\packages\System.Data.SqlClient.4.7.0\lib\net461\System.Data.SqlClient.dll</HintPath>
49+
</Reference>
4750
<Reference Include="System.Web.DynamicData" />
4851
<Reference Include="System.Web.Entity" />
4952
<Reference Include="System.Web.ApplicationServices" />
@@ -77,6 +80,7 @@
7780
<Compile Include="Properties\AssemblyInfo.cs" />
7881
</ItemGroup>
7982
<ItemGroup>
83+
<Content Include="Configuration\ConnectionStrings.config" />
8084
<None Include="packages.config" />
8185
<None Include="Web.Debug.config">
8286
<DependentUpon>Web.config</DependentUpon>
@@ -89,6 +93,24 @@
8993
<Folder Include="App_Data\" />
9094
<Folder Include="Models\" />
9195
</ItemGroup>
96+
<ItemGroup>
97+
<ProjectReference Include="..\Ignia.Topics.Data.Caching\Ignia.Topics.Data.Caching.csproj">
98+
<Project>{206b7f91-ca25-4e9d-9576-60d2e54a2c0a}</Project>
99+
<Name>Ignia.Topics.Data.Caching</Name>
100+
</ProjectReference>
101+
<ProjectReference Include="..\Ignia.Topics.Data.Sql\Ignia.Topics.Data.Sql.csproj">
102+
<Project>{1de1f923-c7c2-435b-b49a-975acbcb5ff0}</Project>
103+
<Name>Ignia.Topics.Data.Sql</Name>
104+
</ProjectReference>
105+
<ProjectReference Include="..\Ignia.Topics.Web\Ignia.Topics.Web.csproj">
106+
<Project>{c98f7b48-a085-4394-b820-c244f23868ce}</Project>
107+
<Name>Ignia.Topics.Web</Name>
108+
</ProjectReference>
109+
<ProjectReference Include="..\Ignia.Topics\Ignia.Topics.csproj">
110+
<Project>{b8d5b290-4451-4c3b-ae9e-0ff075958a74}</Project>
111+
<Name>Ignia.Topics</Name>
112+
</ProjectReference>
113+
</ItemGroup>
92114
<PropertyGroup>
93115
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
94116
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
@@ -120,7 +142,7 @@
120142
</PropertyGroup>
121143
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
122144
</Target>
123-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
145+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
124146
Other similar extension points exist, see Microsoft.Common.targets.
125147
<Target Name="BeforeBuild">
126148
</Target>

Ignia.Topics.Web.Host/Web.config

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
3-
<!--
4-
For more information on how to configure your ASP.NET application, please visit
5-
https://go.microsoft.com/fwlink/?LinkId=169433
6-
-->
72
<configuration>
3+
4+
<connectionStrings configSource="Configuration\ConnectionStrings.config"></connectionStrings>
5+
86
<system.web>
7+
98
<compilation debug="true" targetFramework="4.8"/>
109
<httpRuntime targetFramework="4.8"/>
10+
11+
<pages pageBaseType="Ignia.Topics.Web.TopicPage" theme="Default">
12+
<namespaces>
13+
<add namespace="Ignia.Topics" />
14+
<add namespace="Ignia.Topics.Web" />
15+
</namespaces>
16+
<controls>
17+
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
18+
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
19+
</controls>
20+
</pages>
21+
1122
</system.web>
23+
1224
<system.codedom>
1325
<compilers>
1426
<compiler language="c#;cs;csharp" extension=".cs"
@@ -20,4 +32,4 @@
2032
</compilers>
2133
</system.codedom>
2234

23-
</configuration>
35+
</configuration>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net48" />
4+
<package id="System.Data.SqlClient" version="4.7.0" targetFramework="net48" />
45
</packages>

0 commit comments

Comments
 (0)