Skip to content

Commit a9b59c7

Browse files
committed
Service stack stub
1 parent ab2b762 commit a9b59c7

31 files changed

+11596
-0
lines changed

SqlCop.Service/CheckRequest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using ServiceStack;
6+
7+
namespace SqlCop.Service
8+
{
9+
[Route("/check")]
10+
[Route("/check/{sql}")]
11+
public class CheckRequest
12+
{
13+
public string Sql { get; set; }
14+
public IList<SqlRuleRequest> Rules { get; set; }
15+
}
16+
}

SqlCop.Service/Global.asax

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="SqlCop.Service.Global" Language="C#" %>

SqlCop.Service/Global.asax.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
using ServiceStack;
8+
9+
namespace SqlCop.Service
10+
{
11+
public class Global : System.Web.HttpApplication
12+
{
13+
public class AppHost : AppHostBase
14+
{
15+
//Tell Service Stack the name of your application and where to find your web services
16+
public AppHost() : base("SqlCop Web Services", typeof(SqlCopService).Assembly) { }
17+
18+
public override void Configure(Funq.Container container)
19+
{
20+
//register any dependencies your services use, e.g:
21+
//container.Register<ICacheClient>(new MemoryCacheClient());
22+
}
23+
}
24+
25+
protected void Application_Start(object sender, EventArgs e)
26+
{
27+
new AppHost().Init();
28+
}
29+
30+
protected void Session_Start(object sender, EventArgs e)
31+
{
32+
33+
}
34+
35+
protected void Application_BeginRequest(object sender, EventArgs e)
36+
{
37+
38+
}
39+
40+
protected void Application_AuthenticateRequest(object sender, EventArgs e)
41+
{
42+
43+
}
44+
45+
protected void Application_Error(object sender, EventArgs e)
46+
{
47+
48+
}
49+
50+
protected void Session_End(object sender, EventArgs e)
51+
{
52+
53+
}
54+
55+
protected void Application_End(object sender, EventArgs e)
56+
{
57+
58+
}
59+
}
60+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("SqlCop.Service")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Plex Systems")]
12+
[assembly: AssemblyProduct("SqlCop.Service")]
13+
[assembly: AssemblyCopyright("Copyright © Plex Systems 2014")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("fede9719-6b0c-47de-8c45-2592038dfba2")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]

SqlCop.Service/SqlCop.Service.csproj

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProductVersion>
8+
</ProductVersion>
9+
<SchemaVersion>2.0</SchemaVersion>
10+
<ProjectGuid>{FD52DB84-E8DD-4B83-9881-653DAE8666C2}</ProjectGuid>
11+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
12+
<OutputType>Library</OutputType>
13+
<AppDesignerFolder>Properties</AppDesignerFolder>
14+
<RootNamespace>SqlCop.Service</RootNamespace>
15+
<AssemblyName>SqlCop.Service</AssemblyName>
16+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
17+
<UseIISExpress>true</UseIISExpress>
18+
<IISExpressSSLPort />
19+
<IISExpressAnonymousAuthentication />
20+
<IISExpressWindowsAuthentication />
21+
<IISExpressUseClassicPipelineMode />
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
24+
<DebugSymbols>true</DebugSymbols>
25+
<DebugType>full</DebugType>
26+
<Optimize>false</Optimize>
27+
<OutputPath>bin\</OutputPath>
28+
<DefineConstants>DEBUG;TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="ServiceStack">
43+
<HintPath>..\packages\ServiceStack.4.0.18\lib\net40\ServiceStack.dll</HintPath>
44+
</Reference>
45+
<Reference Include="ServiceStack.Client">
46+
<HintPath>..\packages\ServiceStack.Client.4.0.18\lib\net40\ServiceStack.Client.dll</HintPath>
47+
</Reference>
48+
<Reference Include="ServiceStack.Common">
49+
<HintPath>..\packages\ServiceStack.Common.4.0.18\lib\net40\ServiceStack.Common.dll</HintPath>
50+
</Reference>
51+
<Reference Include="ServiceStack.Interfaces">
52+
<HintPath>..\packages\ServiceStack.Interfaces.4.0.18\lib\net40\ServiceStack.Interfaces.dll</HintPath>
53+
</Reference>
54+
<Reference Include="ServiceStack.Text">
55+
<HintPath>..\packages\ServiceStack.Text.4.0.18\lib\net40\ServiceStack.Text.dll</HintPath>
56+
</Reference>
57+
<Reference Include="System.Web.DynamicData" />
58+
<Reference Include="System.Web.Entity" />
59+
<Reference Include="System.Web.ApplicationServices" />
60+
<Reference Include="System.ComponentModel.DataAnnotations" />
61+
<Reference Include="System" />
62+
<Reference Include="System.Data" />
63+
<Reference Include="System.Core" />
64+
<Reference Include="System.Data.DataSetExtensions" />
65+
<Reference Include="System.Web.Extensions" />
66+
<Reference Include="System.Xml.Linq" />
67+
<Reference Include="System.Drawing" />
68+
<Reference Include="System.Web" />
69+
<Reference Include="System.Xml" />
70+
<Reference Include="System.Configuration" />
71+
<Reference Include="System.Web.Services" />
72+
<Reference Include="System.EnterpriseServices" />
73+
</ItemGroup>
74+
<ItemGroup>
75+
<Content Include="Global.asax" />
76+
<Content Include="Web.config" />
77+
</ItemGroup>
78+
<ItemGroup>
79+
<Compile Include="CheckRequest.cs" />
80+
<Compile Include="Global.asax.cs">
81+
<DependentUpon>Global.asax</DependentUpon>
82+
</Compile>
83+
<Compile Include="Properties\AssemblyInfo.cs" />
84+
<Compile Include="SqlRuleProblemResponse.cs" />
85+
<Compile Include="SqlRuleRequest.cs" />
86+
<Compile Include="SqlCopService.cs" />
87+
</ItemGroup>
88+
<ItemGroup>
89+
<Content Include="packages.config" />
90+
<None Include="Web.Debug.config">
91+
<DependentUpon>Web.config</DependentUpon>
92+
</None>
93+
<None Include="Web.Release.config">
94+
<DependentUpon>Web.config</DependentUpon>
95+
</None>
96+
</ItemGroup>
97+
<PropertyGroup>
98+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
99+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
100+
</PropertyGroup>
101+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
102+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
103+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
104+
<ProjectExtensions>
105+
<VisualStudio>
106+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
107+
<WebProjectProperties>
108+
<UseIIS>True</UseIIS>
109+
<AutoAssignPort>True</AutoAssignPort>
110+
<DevelopmentServerPort>0</DevelopmentServerPort>
111+
<DevelopmentServerVPath>/</DevelopmentServerVPath>
112+
<IISUrl>http://localhost:42020/</IISUrl>
113+
<NTLMAuthentication>False</NTLMAuthentication>
114+
<UseCustomServer>False</UseCustomServer>
115+
<CustomServerUrl>
116+
</CustomServerUrl>
117+
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
118+
</WebProjectProperties>
119+
</FlavorProperties>
120+
</VisualStudio>
121+
</ProjectExtensions>
122+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
123+
Other similar extension points exist, see Microsoft.Common.targets.
124+
<Target Name="BeforeBuild">
125+
</Target>
126+
<Target Name="AfterBuild">
127+
</Target>
128+
-->
129+
</Project>

SqlCop.Service/SqlCopService.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using ServiceStack;
6+
7+
namespace SqlCop.Service
8+
{
9+
public class SqlCopService : ServiceStack.Service
10+
{
11+
public object Any(SqlRuleRequest request)
12+
{
13+
return new SqlRuleProblemResponse();
14+
}
15+
}
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
6+
namespace SqlCop.Service
7+
{
8+
public class SqlRuleProblemResponse
9+
{
10+
public string Description { get; set; }
11+
public string ErrorMessageString { get; set; }
12+
public int StartColumn { get; set; }
13+
public int StartLine { get; set; }
14+
}
15+
}

SqlCop.Service/SqlRuleRequest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
6+
namespace SqlCop.Service
7+
{
8+
public class SqlRuleRequest
9+
{
10+
public string Namespace { get; set; }
11+
public string Id { get; set; }
12+
}
13+
}

SqlCop.Service/Web.Debug.config

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
4+
5+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6+
<!--
7+
In the example below, the "SetAttributes" transform will change the value of
8+
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
9+
finds an attribute "name" that has a value of "MyDB".
10+
11+
<connectionStrings>
12+
<add name="MyDB"
13+
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
14+
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15+
</connectionStrings>
16+
-->
17+
<system.web>
18+
<!--
19+
In the example below, the "Replace" transform will replace the entire
20+
<customErrors> section of your web.config file.
21+
Note that because there is only one customErrors section under the
22+
<system.web> node, there is no need to use the "xdt:Locator" attribute.
23+
24+
<customErrors defaultRedirect="GenericError.htm"
25+
mode="RemoteOnly" xdt:Transform="Replace">
26+
<error statusCode="500" redirect="InternalError.htm"/>
27+
</customErrors>
28+
-->
29+
</system.web>
30+
</configuration>

SqlCop.Service/Web.Release.config

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
4+
5+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6+
<!--
7+
In the example below, the "SetAttributes" transform will change the value of
8+
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
9+
finds an attribute "name" that has a value of "MyDB".
10+
11+
<connectionStrings>
12+
<add name="MyDB"
13+
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
14+
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15+
</connectionStrings>
16+
-->
17+
<system.web>
18+
<compilation xdt:Transform="RemoveAttributes(debug)" />
19+
<!--
20+
In the example below, the "Replace" transform will replace the entire
21+
<customErrors> section of your web.config file.
22+
Note that because there is only one customErrors section under the
23+
<system.web> node, there is no need to use the "xdt:Locator" attribute.
24+
25+
<customErrors defaultRedirect="GenericError.htm"
26+
mode="RemoteOnly" xdt:Transform="Replace">
27+
<error statusCode="500" redirect="InternalError.htm"/>
28+
</customErrors>
29+
-->
30+
</system.web>
31+
</configuration>

SqlCop.Service/Web.config

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
3+
<!--
4+
For more information on how to configure your ASP.NET application, please visit
5+
http://go.microsoft.com/fwlink/?LinkId=169433
6+
-->
7+
8+
<configuration>
9+
<system.web>
10+
<compilation debug="true" targetFramework="4.5" />
11+
<httpRuntime targetFramework="4.5" />
12+
</system.web>
13+
14+
</configuration>

SqlCop.Service/packages.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="ServiceStack" version="4.0.18" targetFramework="net45" />
4+
<package id="ServiceStack.Client" version="4.0.18" targetFramework="net45" />
5+
<package id="ServiceStack.Common" version="4.0.18" targetFramework="net45" />
6+
<package id="ServiceStack.Interfaces" version="4.0.18" targetFramework="net45" />
7+
<package id="ServiceStack.Text" version="4.0.18" targetFramework="net45" />
8+
</packages>

0 commit comments

Comments
 (0)