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 befc688 commit 7b3af01
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 231 deletions.
7 changes: 4 additions & 3 deletions src/AwsApps/AdminTasks.cs
Expand Up @@ -6,15 +6,16 @@
using ServiceStack.Configuration;
using ServiceStack.Testing;
using ServiceStack.Text;
using ServiceStack.VirtualPath;
using ServiceStack.IO;
using FileSystemVirtualFiles = ServiceStack.IO.FileSystemVirtualFiles;

namespace AwsApps
{
[TestFixture]
public class AdminTasks
{
private readonly ServiceStackHost appHost;
S3VirtualPathProvider s3;
S3VirtualFiles s3;

public AdminTasks()
{
Expand Down Expand Up @@ -44,7 +45,7 @@ public void Drop_and_Create_ssawsdemo_Bucket()
[Test]
public void Import_RestFiles_into_S3()
{
var fs = new FileSystemVirtualPathProvider(appHost, "~/restfiles".MapHostAbsolutePath());
var fs = new FileSystemVirtualFiles("~/restfiles".MapHostAbsolutePath());
var skipDirs = new[] { "restfiles/files" };

foreach (var file in fs.GetAllFiles())
Expand Down
10 changes: 2 additions & 8 deletions src/AwsApps/AppHost.cs
Expand Up @@ -42,7 +42,8 @@ public override void Configure(Container container)

//Comment out 2 lines below to change to use local FileSystem instead of S3
var s3Client = new AmazonS3Client(AwsConfig.AwsAccessKey, AwsConfig.AwsSecretKey, RegionEndpoint.USEast1);
VirtualFiles = new S3VirtualPathProvider(s3Client, AwsConfig.S3BucketName, this);
VirtualFiles = new S3VirtualFiles(s3Client, AwsConfig.S3BucketName);
AddVirtualFileSources.Add(VirtualFiles);

container.Register<IPocoDynamo>(c => new PocoDynamo(AwsConfig.CreateAmazonDynamoDb()));
var db = container.Resolve<IPocoDynamo>();
Expand All @@ -63,13 +64,6 @@ public override void Configure(Container container)
container.RegisterValidators(typeof(EmailContacts.CreateContact).Assembly);
}

public override List<IVirtualPathProvider> GetVirtualFileSources()
{
var fileSources = base.GetVirtualFileSources();
fileSources.Add(VirtualFiles);
return fileSources;
}

public AuthFeature CreateAuthFeature()
{
return new AuthFeature(() => new AuthUserSession(),
Expand Down
109 changes: 49 additions & 60 deletions src/AwsApps/AwsApps.csproj
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" />
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="..\packages\Microsoft.Net.Compilers.2.6.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.6.0\build\Microsoft.Net.Compilers.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -24,6 +23,7 @@
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<Use64BitIISExpress />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -43,78 +43,62 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AWSSDK.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.Core.3.1.10.0\lib\net45\AWSSDK.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.Core.3.3.21\lib\net45\AWSSDK.Core.dll</HintPath>
</Reference>
<Reference Include="AWSSDK.DynamoDBv2, Version=3.1.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.DynamoDBv2.3.1.5.3\lib\net45\AWSSDK.DynamoDBv2.dll</HintPath>
<Private>True</Private>
<Reference Include="AWSSDK.DynamoDBv2, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.DynamoDBv2.3.3.5\lib\net45\AWSSDK.DynamoDBv2.dll</HintPath>
</Reference>
<Reference Include="AWSSDK.S3, Version=3.1.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.S3.3.1.9.0\lib\net45\AWSSDK.S3.dll</HintPath>
<Private>True</Private>
<Reference Include="AWSSDK.S3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.S3.3.3.15\lib\net45\AWSSDK.S3.dll</HintPath>
</Reference>
<Reference Include="AWSSDK.SimpleEmail, Version=3.1.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.SimpleEmail.3.1.1.1\lib\net45\AWSSDK.SimpleEmail.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="AWSSDK.SQS, Version=3.1.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.SQS.3.1.0.13\lib\net45\AWSSDK.SQS.dll</HintPath>
<Private>True</Private>
<Reference Include="AWSSDK.SQS, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.SQS.3.3.3.2\lib\net45\AWSSDK.SQS.dll</HintPath>
</Reference>
<Reference Include="DotNetOpenAuth, Version=4.3.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetOpenAuth.Ultimate.4.3.4.13329\lib\net45-full\DotNetOpenAuth.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.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="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Authentication.OAuth2, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Authentication.OAuth2.4.5.0\lib\net45\ServiceStack.Authentication.OAuth2.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.Authentication.OpenId, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Authentication.OpenId.4.5.0\lib\net45\ServiceStack.Authentication.OpenId.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.Authentication.OAuth2, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Authentication.OAuth2.5.0.0\lib\net45\ServiceStack.Authentication.OAuth2.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Aws, Version=4.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Aws.4.5.0\lib\net45\ServiceStack.Aws.dll</HintPath>
<Private>True</Private>
<Reference Include="ServiceStack.Authentication.OpenId, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Authentication.OpenId.5.0.0\lib\net45\ServiceStack.Authentication.OpenId.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.Aws, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Aws.5.0.0\lib\net45\ServiceStack.Aws.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.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.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.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.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.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.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.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.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.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=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.ComponentModel.DataAnnotations" />
<Reference Include="System" />
Expand All @@ -133,9 +117,20 @@
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Drawing" />
<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" />
<Reference Include="System.Configuration" />
Expand Down Expand Up @@ -219,11 +214,6 @@
<ItemGroup>
<Folder Include="imgur\uploads\" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\AWSSDK.DynamoDBv2.3.1.5.3\analyzers\dotnet\cs\AWSSDK.DynamoDBv2.CodeAnalysis.dll" />
<Analyzer Include="..\packages\AWSSDK.S3.3.1.9.0\analyzers\dotnet\cs\AWSSDK.S3.CodeAnalysis.dll" />
<Analyzer Include="..\packages\AWSSDK.SQS.3.1.0.13\analyzers\dotnet\cs\AWSSDK.SQS.CodeAnalysis.dll" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
Expand Down Expand Up @@ -254,8 +244,7 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use 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('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.6.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.6.0\build\Microsoft.Net.Compilers.props'))" />
</Target>
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
5 changes: 3 additions & 2 deletions src/AwsApps/AwsConfig.cs
Expand Up @@ -6,6 +6,7 @@
using ServiceStack.Aws.DynamoDb;
using ServiceStack.Aws.S3;
using ServiceStack.Configuration;
using ServiceStack.IO;

namespace AwsApps
{
Expand Down Expand Up @@ -35,9 +36,9 @@ public static AmazonS3Client CreateAmazonS3Client()
return new AmazonS3Client(AwsAccessKey, AwsSecretKey, RegionEndpoint.USEast1);
}

public static S3VirtualPathProvider CreateS3VirtualPathProvider(IAppHost appHost, string bucketName)
public static S3VirtualFiles CreateS3VirtualPathProvider(IAppHost appHost, string bucketName)
{
return new S3VirtualPathProvider(CreateAmazonS3Client(), bucketName, appHost);
return new S3VirtualFiles(CreateAmazonS3Client(), bucketName);
}

public static string AwsAccessKey
Expand Down
26 changes: 26 additions & 0 deletions src/AwsApps/Web.Release.config
Expand Up @@ -14,6 +14,32 @@
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->

<appSettings>
<!-- Auth config -->
<add key="oauth.RedirectUrl" value="http://awsapps.servicestack.net/" />
<!-- Should match with OAuth2's App Callback URL -->
<add key="oauth.CallbackUrl" value="http://awsapps.servicestack.net/auth/{0}" />
<!-- Create Twitter App at: https://dev.twitter.com/apps -->
<add key="oauth.twitter.ConsumerKey" value="1bGbGWUvD7UlPZScqcgU25sxR" />
<add key="oauth.twitter.ConsumerSecret" value="atA0n12H4g4qqBDk8B07Mr39iyseAmTTCK3rg5Ljx78hlCJJdN" />
<!-- Create Facebook App at: https://developers.facebook.com/apps -->
<add key="oauth.facebook.Permissions" value="email" />
<add key="oauth.facebook.AppId" value="1934838220075493" />
<add key="oauth.facebook.AppSecret" value="2a546b53bc0151244eab85ddc2c165a1" />
<!--Create GitHub App at: https://github.com/settings/applications/new -->
<add key="oauth.github.Scopes" value="user" />
<add key="oauth.github.ClientId" value="4b2182efb0f2517b78d4" />
<add key="oauth.github.ClientSecret" value="789f44c77e70e9d3fa3624efc2105bbc71f58efe" />
<!-- Create Google App at: https://code.google.com/apis/console/ -->
<add key="oauth.GoogleOAuth.ConsumerKey" value="731622862518-jkclgqakl3bnb3707b7bfn2m110juj2d.apps.googleusercontent.com" />
<add key="oauth.GoogleOAuth.ConsumerSecret" value="CdIcaO5pWPyCIncIfAiu9Xfj" />
<add key="oauth.GoogleOAuth.AuthorizeUrl" value="https://accounts.google.com/o/oauth2/auth?prompt=consent" />
<!-- Create LinkedIn App at: https://www.linkedin.com/secure/developer?newapp= -->
<add key="oauth.LinkedIn.ConsumerKey" value="774uma32202poi" />
<add key="oauth.LinkedIn.ConsumerSecret" value="Hk77gh8Fgkfj3528" />
</appSettings>

<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
Expand Down

0 comments on commit 7b3af01

Please sign in to comment.