Skip to content

Commit 07a7010

Browse files
committed
SQLLite issues
1 parent c9ff826 commit 07a7010

File tree

5 files changed

+131
-132
lines changed

5 files changed

+131
-132
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.Linq;
3+
using System.Configuration;
4+
using System.Collections.Generic;
5+
using ServiceStack.Configuration;
6+
using ServiceStack.OrmLite;
7+
using ServiceStack.ServiceInterface;
8+
using ServiceStack.ServiceInterface.Auth;
9+
using ServiceStack.ServiceInterface.ServiceModel;
10+
using ServiceStack.WebHost.Endpoints;
11+
12+
[assembly: WebActivator.PreApplicationStartMethod(typeof(ServiceStack.MovieRest.App_Start.MovieAppHost), "Start")]
13+
14+
15+
/**
16+
* Entire ServiceStack Starter Template configured with a 'Hello' Web Service and a 'Todo' Rest Service.
17+
*
18+
* Auto-Generated Metadata API page at: /metadata
19+
* See other complete web service examples at: https://github.com/ServiceStack/ServiceStack.Examples
20+
*/
21+
22+
namespace ServiceStack.MovieRest.App_Start
23+
{
24+
using ServiceStack.Common.Utils;
25+
using ServiceStack.OrmLite.Sqlite;
26+
using ServiceStack.ServiceInterface.Cors;
27+
28+
public class MovieAppHost
29+
: AppHostBase
30+
{
31+
/// <summary>
32+
/// Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
33+
/// </summary>
34+
public MovieAppHost() : base("ServiceStack REST at the Movies!", typeof (MovieService).Assembly)
35+
{
36+
}
37+
38+
public override void Configure(Funq.Container container)
39+
{
40+
//Set JSON web services to return idiomatic JSON camelCase properties
41+
ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;
42+
43+
container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory("~/App_Data/db.sqlite".MapHostAbsolutePath(), SqliteOrmLiteDialectProvider.Instance));
44+
45+
using (var resetMovies = container.Resolve<ResetMoviesService>())
46+
{
47+
resetMovies.Any(null);
48+
}
49+
50+
Plugins.Add(new CorsFeature()); //Enable CORS
51+
52+
SetConfig(new EndpointHostConfig
53+
{
54+
DebugMode = true //Show StackTraces for easier debugging (default auto inferred by Debug/Release builds)
55+
});
56+
}
57+
58+
59+
60+
public static void Start()
61+
{
62+
new MovieAppHost().Init();
63+
}
64+
}
65+
}
Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,8 @@
11
namespace ServiceStack.MovieRest
22
{
3-
using System;
43
using System.Web;
5-
using Funq;
6-
using ServiceStack.Common.Utils;
7-
using ServiceStack.OrmLite;
8-
using ServiceStack.OrmLite.Sqlite;
9-
using ServiceStack.ServiceHost;
10-
using ServiceStack.ServiceInterface.Cors;
11-
using ServiceStack.WebHost.Endpoints;
12-
13-
/// <summary>
14-
/// Create your ServiceStack web service application with a singleton AppHost.
15-
/// </summary>
16-
public class MovieAppHost : AppHostBase
17-
{
18-
/// <summary>
19-
/// Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
20-
/// </summary>
21-
public MovieAppHost() : base("ServiceStack REST at the Movies!", typeof (MovieService).Assembly)
22-
{
23-
}
24-
25-
/// <summary>
26-
/// Configure the container with the necessary routes for your ServiceStack application.
27-
/// </summary>
28-
/// <param name="container">The built-in IoC used with ServiceStack.</param>
29-
public override void Configure(Container container)
30-
{
31-
//JsConfig.DateHandler = JsonDateHandler.ISO8601;
32-
33-
container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory("~/App_Data/db.sqlite".MapHostAbsolutePath(), SqliteOrmLiteDialectProvider.Instance));
34-
35-
//Call existing service
36-
using (var resetMovies = container.Resolve<ResetMoviesService>())
37-
{
38-
resetMovies.Any(null);
39-
}
40-
41-
Plugins.Add(new CorsFeature()); //Enable CORS
42-
43-
SetConfig(new EndpointHostConfig
44-
{
45-
DebugMode = true, //Show StackTraces for easier debugging (default auto inferred by Debug/Release builds)
46-
MetadataVisibility = EndpointAttributes.Any
47-
});
48-
}
49-
}
504

515
public class Global : HttpApplication
526
{
53-
protected void Application_Start(object sender, EventArgs e)
54-
{
55-
//Initialize your application
56-
(new MovieAppHost()).Init();
57-
}
587
}
598
}

src/ServiceStack.MovieRest/Web/ServiceStack.MovieRest.csproj

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@
1212
<AppDesignerFolder>Properties</AppDesignerFolder>
1313
<RootNamespace>ServiceStack.MovieRest</RootNamespace>
1414
<AssemblyName>ServiceStack.MovieRest</AssemblyName>
15-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
15+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1616
<FileUpgradeFlags>
1717
</FileUpgradeFlags>
1818
<OldToolsVersion>4.0</OldToolsVersion>
1919
<UpgradeBackupLocation>
2020
</UpgradeBackupLocation>
21-
<UseIISExpress>false</UseIISExpress>
21+
<UseIISExpress>true</UseIISExpress>
2222
<IISExpressSSLPort />
2323
<IISExpressAnonymousAuthentication />
2424
<IISExpressWindowsAuthentication />
2525
<IISExpressUseClassicPipelineMode />
2626
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
2727
<RestorePackages>true</RestorePackages>
28+
<TargetFrameworkProfile />
2829
</PropertyGroup>
2930
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3031
<DebugSymbols>true</DebugSymbols>
@@ -48,8 +49,13 @@
4849
<PlatformTarget>x86</PlatformTarget>
4950
</PropertyGroup>
5051
<ItemGroup>
51-
<Reference Include="Mono.Data.Sqlite">
52-
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.59\lib\net35\Mono.Data.Sqlite.dll</HintPath>
52+
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
53+
<Private>True</Private>
54+
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
55+
</Reference>
56+
<Reference Include="Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
57+
<SpecificVersion>False</SpecificVersion>
58+
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.59\lib\net40\Mono.Data.Sqlite.dll</HintPath>
5359
</Reference>
5460
<Reference Include="ServiceStack">
5561
<HintPath>..\packages\ServiceStack.3.9.59\lib\net35\ServiceStack.dll</HintPath>
@@ -63,10 +69,11 @@
6369
</Reference>
6470
<Reference Include="ServiceStack.OrmLite, Version=3.9.59.0, Culture=neutral, processorArchitecture=MSIL">
6571
<SpecificVersion>False</SpecificVersion>
66-
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.59\lib\net35\ServiceStack.OrmLite.dll</HintPath>
72+
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.59\lib\net40\ServiceStack.OrmLite.dll</HintPath>
6773
</Reference>
68-
<Reference Include="ServiceStack.OrmLite.Sqlite">
69-
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.59\lib\net35\ServiceStack.OrmLite.Sqlite.dll</HintPath>
74+
<Reference Include="ServiceStack.OrmLite.Sqlite, Version=3.9.59.0, Culture=neutral, processorArchitecture=x86">
75+
<SpecificVersion>False</SpecificVersion>
76+
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.59\lib\net40\ServiceStack.OrmLite.Sqlite.dll</HintPath>
7077
</Reference>
7178
<Reference Include="ServiceStack.OrmLite.SqlServer">
7279
<HintPath>..\packages\ServiceStack.OrmLite.SqlServer.3.9.59\lib\ServiceStack.OrmLite.SqlServer.dll</HintPath>
@@ -85,45 +92,56 @@
8592
</Reference>
8693
<Reference Include="System" />
8794
<Reference Include="System.Data" />
88-
<Reference Include="System.Core">
89-
<RequiredTargetFramework>3.5</RequiredTargetFramework>
95+
<Reference Include="System.Data.DataSetExtensions" />
96+
<Reference Include="System.Data.SQLite">
97+
<HintPath>..\packages\System.Data.SQLite.1.0.88.0\lib\net40\System.Data.SQLite.dll</HintPath>
9098
</Reference>
91-
<Reference Include="System.Data.DataSetExtensions">
92-
<RequiredTargetFramework>3.5</RequiredTargetFramework>
99+
<Reference Include="System.Data.SQLite.Linq">
100+
<HintPath>..\packages\System.Data.SQLite.1.0.88.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
93101
</Reference>
94102
<Reference Include="System.Runtime.Serialization">
95103
<RequiredTargetFramework>3.0</RequiredTargetFramework>
96104
</Reference>
97-
<Reference Include="System.Web.Extensions">
98-
<RequiredTargetFramework>3.5</RequiredTargetFramework>
99-
</Reference>
100-
<Reference Include="System.Xml.Linq">
101-
<RequiredTargetFramework>3.5</RequiredTargetFramework>
102-
</Reference>
105+
<Reference Include="System.Web.ApplicationServices" />
106+
<Reference Include="System.Web.DynamicData" />
107+
<Reference Include="System.Web.Entity" />
108+
<Reference Include="System.Web.Extensions" />
103109
<Reference Include="System.Drawing" />
104110
<Reference Include="System.Web" />
105111
<Reference Include="System.Xml" />
106112
<Reference Include="System.Configuration" />
113+
<Reference Include="System.Xml.Linq" />
114+
<Reference Include="WebActivator">
115+
<HintPath>..\packages\WebActivator.1.5.3\lib\net40\WebActivator.dll</HintPath>
116+
<Private>True</Private>
117+
</Reference>
107118
</ItemGroup>
108119
<ItemGroup>
109120
<Content Include="Content\Css\default.css" />
110121
<Content Include="default.htm" />
111122
<Content Include="Global.asax" />
112123
<Content Include="Content\Images\bg-body-1024.png" />
113124
<Content Include="Content\Images\btn-github.png" />
114-
<None Include="Scripts\jquery-2.0.3.intellisense.js" />
115-
<Content Include="Scripts\jquery-2.0.3.js" />
116-
<Content Include="Scripts\jquery-2.0.3.min.js" />
117125
<Content Include="sqlite\x64\sqlite3.dll" />
118126
<Content Include="sqlite\x86\sqlite3.def" />
119127
<Content Include="sqlite\x86\sqlite3.dll" />
120128
<Content Include="sqlite\x86\sqlite3.exe" />
129+
<Content Include="x64\SQLite.Interop.dll">
130+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
131+
</Content>
132+
<Content Include="x86\SQLite.Interop.dll">
133+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
134+
</Content>
135+
<None Include="Scripts\jquery-2.0.3.intellisense.js" />
136+
<Content Include="Scripts\jquery-2.0.3.js" />
137+
<Content Include="Scripts\jquery-2.0.3.min.js" />
121138
<Content Include="Web.config">
122139
<SubType>Designer</SubType>
123140
</Content>
124141
<Content Include="Scripts\jquery-2.0.3.min.map" />
125142
</ItemGroup>
126143
<ItemGroup>
144+
<Compile Include="App_Start\AppHost.cs" />
127145
<Compile Include="ResetMovies.cs" />
128146
<Compile Include="MovieService.cs" />
129147
<Compile Include="Global.asax.cs">
@@ -159,7 +177,7 @@
159177
<AutoAssignPort>True</AutoAssignPort>
160178
<DevelopmentServerPort>55867</DevelopmentServerPort>
161179
<DevelopmentServerVPath>/</DevelopmentServerVPath>
162-
<IISUrl>http://localhost/ServiceStack.MovieRest</IISUrl>
180+
<IISUrl>http://localhost:55867/</IISUrl>
163181
<NTLMAuthentication>False</NTLMAuthentication>
164182
<UseCustomServer>False</UseCustomServer>
165183
<CustomServerUrl>
Lines changed: 23 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,25 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<configSections>
4-
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
5-
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
6-
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
7-
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
8-
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
9-
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
10-
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
11-
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
12-
</sectionGroup>
13-
</sectionGroup>
14-
</sectionGroup>
15-
</configSections>
163
<appSettings>
17-
<!-- for Apache + mod_mono -->
18-
<add key="MonoServerDefaultIndexFiles" value="default.htm" />
4+
<!-- for Apache + mod_mono -->
5+
<add key="MonoServerDefaultIndexFiles" value="default.htm" />
196
</appSettings>
207
<connectionStrings />
21-
228
<system.web>
23-
<!--
9+
<!--
2410
Set compilation debug="true" to insert debugging
2511
symbols into the compiled page. Because this
2612
affects performance, set this value to true only
2713
during development.
2814
-->
29-
<compilation debug="true">
30-
<assemblies>
31-
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
32-
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
33-
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
34-
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
35-
</assemblies>
36-
</compilation>
37-
<!--
15+
<compilation debug="true" targetFramework="4.0" />
16+
<!--
3817
The <authentication> section enables configuration
3918
of the security authentication mode used by
4019
ASP.NET to identify an incoming user.
4120
-->
42-
<authentication mode="Windows" />
43-
<!--
21+
<authentication mode="Windows" />
22+
<!--
4423
The <customErrors> section enables configuration
4524
of what to do if/when an unhandled error occurs
4625
during the execution of a request. Specifically,
@@ -52,44 +31,29 @@
5231
<error statusCode="404" redirect="FileNotFound.htm" />
5332
</customErrors>
5433
-->
55-
<httpHandlers>
56-
<!-- ServiceStack: Handler mapping for IIS 6.0, MONO or VS.NET dev web server -->
57-
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
58-
</httpHandlers>
34+
<httpHandlers>
35+
<!-- ServiceStack: Handler mapping for IIS 6.0, MONO or VS.NET dev web server -->
36+
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
37+
</httpHandlers>
38+
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
5939
</system.web>
60-
<system.codedom>
61-
<compilers>
62-
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
63-
<providerOption name="CompilerVersion" value="v3.5" />
64-
<providerOption name="WarnAsError" value="false" />
65-
</compiler>
66-
</compilers>
67-
</system.codedom>
6840
<!--
6941
The system.webServer section is required for running ASP.NET AJAX under Internet
7042
Information Services 7.0. It is not necessary for previous version of IIS.
7143
-->
7244
<system.webServer>
73-
<modules runAllManagedModulesForAllRequests="true"/>
74-
<validation validateIntegratedModeConfiguration="false" />
75-
<handlers>
76-
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
77-
</handlers>
45+
<modules runAllManagedModulesForAllRequests="true" />
46+
<validation validateIntegratedModeConfiguration="false" />
47+
<handlers>
48+
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
49+
</handlers>
7850
</system.webServer>
7951
<runtime>
80-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727">
81-
<dependentAssembly>
82-
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
83-
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
84-
</dependentAssembly>
85-
<dependentAssembly>
86-
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
87-
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
88-
</dependentAssembly>
89-
<dependentAssembly>
90-
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
91-
<bindingRedirect oldVersion="0.0.0.0-1.0.88.0" newVersion="1.0.88.0" />
92-
</dependentAssembly>
93-
</assemblyBinding>
52+
<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
53+
<dependentAssembly>
54+
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
55+
<bindingRedirect oldVersion="0.0.0.0-1.0.88.0" newVersion="1.0.88.0" />
56+
</dependentAssembly>
57+
</assemblyBinding>
9458
</runtime>
9559
</configuration>
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="jQuery" version="2.0.3" targetFramework="net35" />
4+
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
45
<package id="ServiceStack" version="3.9.59" targetFramework="net35" />
56
<package id="ServiceStack.Common" version="3.9.59" targetFramework="net35" />
6-
<package id="ServiceStack.OrmLite.Sqlite.Mono" version="3.9.59" targetFramework="net35" />
7+
<package id="ServiceStack.OrmLite.Sqlite.Mono" version="3.9.59" targetFramework="net40" />
78
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.59" targetFramework="net35" />
89
<package id="ServiceStack.Redis" version="3.9.59" targetFramework="net35" />
910
<package id="ServiceStack.Text" version="3.9.59" targetFramework="net35" />
11+
<package id="System.Data.SQLite" version="1.0.88.0" targetFramework="net40" />
12+
<package id="WebActivator" version="1.5.3" targetFramework="net40" />
1013
</packages>

0 commit comments

Comments
 (0)