Skip to content

Commit

Permalink
Upgrade to ServiceStack v5
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Dec 11, 2017
1 parent edbf070 commit 0b2c4b5
Show file tree
Hide file tree
Showing 42 changed files with 748 additions and 668 deletions.
6 changes: 3 additions & 3 deletions src/.vs/config/applicationhost.config
Expand Up @@ -163,23 +163,23 @@
</site>
<site name="RazorRockstars.WebHost" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\src\RazorRockstars\src\RazorRockstars.WebHost" />
<virtualDirectory path="/" physicalPath="C:\src\Apps\RazorRockstars\src\RazorRockstars.WebHost" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:2000:localhost" />
</bindings>
</site>
<site name="RazorRockstars.CompiledViews.WebHost" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\src\RazorRockstars\src\RazorRockstars.CompiledViews.WebHost" />
<virtualDirectory path="/" physicalPath="C:\src\Apps\RazorRockstars\src\RazorRockstars.CompiledViews.WebHost" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:2005:localhost" />
</bindings>
</site>
<site name="RazorRockstars.S3" id="4">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\src\RazorRockstars\src\RazorRockstars.S3" />
<virtualDirectory path="/" physicalPath="C:\src\Apps\RazorRockstars\src\RazorRockstars.S3" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:61364:localhost" />
Expand Down
2 changes: 2 additions & 0 deletions src/RazorRockstars.CompiledViews.SelfHost/AppHost.cs
Expand Up @@ -2,6 +2,7 @@
using Funq;
using ServiceStack;
using ServiceStack.Data;
using ServiceStack.Formats;
using ServiceStack.OrmLite;
using ServiceStack.Razor;

Expand All @@ -22,6 +23,7 @@ public override void Configure(Container container)
Plugins.Add(new RazorFormat {
LoadFromAssemblies = { typeof(RockstarsService).Assembly }
});
Plugins.Add(new MarkdownFormat());

Plugins.Add(new PostmanFeature());
Plugins.Add(new CorsFeature());
Expand Down
43 changes: 0 additions & 43 deletions src/RazorRockstars.CompiledViews.SelfHost/Program.cs
Expand Up @@ -15,8 +15,6 @@ static void Main(string[] args)
{
//LogManager.LogFactory = new ConsoleLogFactory();

ExportMonoSqliteDll();

new AppHost()
.Init()
.Start("http://*:3333/");
Expand All @@ -27,46 +25,5 @@ static void Main(string[] args)

Thread.Sleep(Timeout.Infinite);
}

public static void ExportMonoSqliteDll()
{
if (Env.IsMono)
return; //Uses system sqlite3.so or sqlite3.dylib

var resPath = "{0}.sqlite3.dll".Fmt(typeof(AppHost).Namespace);

var resInfo = typeof(AppHost).Assembly.GetManifestResourceInfo(resPath);
if (resInfo == null)
throw new Exception("Couldn't load sqlite3.dll");

var dllBytes = typeof(AppHost).Assembly.GetManifestResourceStream(resPath).ReadFully();
var dirPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

var filePath = Path.Combine(dirPath, "sqlite3.dll");

File.WriteAllBytes(filePath, dllBytes);
}

public static void ExportWindowsSqliteDll()
{
var resPath = "{0}.{1}.SQLite.Interop.dll".Fmt(typeof(AppHost).Namespace, Environment.Is64BitProcess ? "x64" : "x86");

var resInfo = typeof(AppHost).Assembly.GetManifestResourceInfo(resPath);
if (resInfo == null)
throw new Exception("Couldn't load SQLite.Interop.dll");

var dllBytes = typeof(AppHost).Assembly.GetManifestResourceStream(resPath).ReadFully();

var dirPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
Environment.Is64BitProcess ? "x64" : "x86");

var filePath = Path.Combine(dirPath, "SQLite.Interop.dll");

if (!Directory.Exists(dirPath))
Directory.CreateDirectory(dirPath);

File.WriteAllBytes(filePath, dllBytes);
}

}
}
Expand Up @@ -13,6 +13,8 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -36,48 +38,53 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\Mono.Data.Sqlite.dll</HintPath>
<Private>True</Private>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="ServiceStack, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.4.5.0\lib\net45\ServiceStack.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.5.0.0\lib\net45\ServiceStack.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Client, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Client.4.5.0\lib\net45\ServiceStack.Client.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Client.5.0.0\lib\net45\ServiceStack.Client.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Common, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Common.4.5.0\lib\net45\ServiceStack.Common.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.Common, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Common.5.0.0\lib\net45\ServiceStack.Common.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Interfaces, Version=4.0.0.0, Culture=neutral, PublicKeyToken=e06fbc6124f57c43, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Interfaces.4.5.0\lib\portable-wp80+sl5+net45+win8+wpa81+monotouch+monoandroid+xamarin.ios10\ServiceStack.Interfaces.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Interfaces.5.0.0\lib\net45\ServiceStack.Interfaces.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.OrmLite, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.OrmLite.4.5.0\lib\net45\ServiceStack.OrmLite.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.OrmLite, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.OrmLite.5.0.0\lib\net45\ServiceStack.OrmLite.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.OrmLite.Sqlite, Version=4.5.0.0, Culture=neutral, processorArchitecture=x86">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.4.5.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.OrmLite.Sqlite, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.OrmLite.Sqlite.5.0.0\lib\net45\ServiceStack.OrmLite.Sqlite.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Razor, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Razor.4.5.0\lib\net45\ServiceStack.Razor.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.Razor, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Razor.5.0.0\lib\net45\ServiceStack.Razor.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.4.5.0\lib\net45\ServiceStack.Text.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.Text, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.5.0.0\lib\net45\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.106.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.106.0\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Razor.4.5.0\lib\net45\System.Web.Razor.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand All @@ -100,19 +107,16 @@
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="sqlite3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.106.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.106.0\build\net45\System.Data.SQLite.Core.targets'))" />
</Target>
<Import Project="..\packages\System.Data.SQLite.Core.1.0.106.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.106.0\build\net45\System.Data.SQLite.Core.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
19 changes: 11 additions & 8 deletions src/RazorRockstars.CompiledViews.SelfHost/packages.config
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
<package id="ServiceStack" version="4.5.0" targetFramework="net45" />
<package id="ServiceStack.Client" version="4.5.0" targetFramework="net45" />
<package id="ServiceStack.Common" version="4.5.0" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="4.5.0" targetFramework="net45" />
<package id="ServiceStack.OrmLite" version="4.5.0" targetFramework="net45" />
<package id="ServiceStack.OrmLite.Sqlite.Mono" version="4.5.0" targetFramework="net45" />
<package id="ServiceStack.Razor" version="4.5.0" targetFramework="net45" />
<package id="ServiceStack.Text" version="4.5.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="ServiceStack" version="5.0.0" targetFramework="net45" />
<package id="ServiceStack.Client" version="5.0.0" targetFramework="net45" />
<package id="ServiceStack.Common" version="5.0.0" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.0.0" targetFramework="net45" />
<package id="ServiceStack.OrmLite" version="5.0.0" targetFramework="net45" />
<package id="ServiceStack.OrmLite.Sqlite" version="5.0.0" targetFramework="net45" />
<package id="ServiceStack.Razor" version="5.0.0" targetFramework="net45" />
<package id="ServiceStack.Text" version="5.0.0" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.106.0" targetFramework="net45" />
</packages>
Binary file not shown.
2 changes: 2 additions & 0 deletions src/RazorRockstars.CompiledViews.WebHost/AppHost.cs
Expand Up @@ -3,6 +3,7 @@
using Funq;
using ServiceStack;
using ServiceStack.Data;
using ServiceStack.Formats;
using ServiceStack.Logging;
using ServiceStack.OrmLite;
using ServiceStack.Razor;
Expand All @@ -28,6 +29,7 @@ public override void Configure(Container container)
{
LoadFromAssemblies = { typeof(RockstarsService).Assembly }
});
Plugins.Add(new MarkdownFormat());
Plugins.Add(new PostmanFeature());
Plugins.Add(new CorsFeature());

Expand Down

0 comments on commit 0b2c4b5

Please sign in to comment.