Skip to content

Commit

Permalink
upgrading to 5.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
aliostad committed May 6, 2018
1 parent ca16e65 commit 5a35455
Show file tree
Hide file tree
Showing 19 changed files with 219 additions and 70 deletions.
7 changes: 7 additions & 0 deletions CacheCow.Samples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CacheCow.Server", "src\Cach
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CacheCow.Server.WebApi", "src\CacheCow.Server.WebApi\CacheCow.Server.WebApi.csproj", "{7B371E13-96BF-4F3D-A3A5-EC3E6BD9D2CD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CacheCow.Samples.WebApi", "samples\CacheCow.Samples.WebApi\CacheCow.Samples.WebApi.csproj", "{9BAE6F47-2E77-4D20-AAA1-DDB26F23E9C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -55,6 +57,10 @@ Global
{7B371E13-96BF-4F3D-A3A5-EC3E6BD9D2CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B371E13-96BF-4F3D-A3A5-EC3E6BD9D2CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B371E13-96BF-4F3D-A3A5-EC3E6BD9D2CD}.Release|Any CPU.Build.0 = Release|Any CPU
{9BAE6F47-2E77-4D20-AAA1-DDB26F23E9C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BAE6F47-2E77-4D20-AAA1-DDB26F23E9C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BAE6F47-2E77-4D20-AAA1-DDB26F23E9C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BAE6F47-2E77-4D20-AAA1-DDB26F23E9C1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -67,6 +73,7 @@ Global
{7750962C-BA57-49F0-AD66-7ACC85A2BDF2} = {37A9D060-F7CD-4FDE-8BE3-28C2AF1F21BD}
{0ABF2C1E-5A02-40DD-83CE-45F1827ADF79} = {8F731FE7-74D7-4733-B402-249352235A33}
{7B371E13-96BF-4F3D-A3A5-EC3E6BD9D2CD} = {8F731FE7-74D7-4733-B402-249352235A33}
{9BAE6F47-2E77-4D20-AAA1-DDB26F23E9C1} = {37A9D060-F7CD-4FDE-8BE3-28C2AF1F21BD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E7779A1-9A5D-4809-B8DF-D31B56406DFF}
Expand Down
57 changes: 57 additions & 0 deletions samples/CacheCow.Samples.Common/MenuBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace CacheCow.Samples.Common
{
public abstract class MenuBase
{
public async Task Menu()
{
while (true)
{
Console.WriteLine(
@"CacheCow Cars Samples - (ASP.NET Core MVC and HttpClient)
- Press 0 to list all cars
- Press 1 to create a new car and add to repo
- Press 2 to update the last item (updates last modified)
- Press 3 to delete the last item
- Press 4 to get the last item
- Press x to exit
"
);
var key = Console.ReadKey(true);
switch (key.KeyChar)
{
case 'x':
return;
case '0':
await ListAll();
break;
case '1':
await CreateNew();
break;
case '2':
await UpdateLast();
break;
case '3':
await DeleteLast();
break;
case '4':
await GetLast();
break;
default:
// nothing
break;
}
}
}

public abstract Task GetLast();
public abstract Task DeleteLast();
public abstract Task UpdateLast();
public abstract Task CreateNew();
public abstract Task ListAll();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.5" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.0.2" />
</ItemGroup>

Expand Down
74 changes: 16 additions & 58 deletions samples/CacheCow.Samples.MvcCore/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,72 +11,30 @@

namespace CacheCow.Samples.MvcCore
{
class Program

class Program : MenuBase
{
private static TestServer _server;
private static HttpClient _client;
private TestServer _server;
private HttpClient _client;

static void Main(string[] args)
{
var p = new Program();
// setup
_server = new TestServer(new WebHostBuilder()
p._server = new TestServer(new WebHostBuilder()
.UseStartup<Startup>());
var handler = _server.CreateHandler();

_client = ClientExtensions.CreateClient(handler);
_client.BaseAddress = _server.BaseAddress;
var handler = p._server.CreateHandler();

Task.Run(RunAsync).Wait();
p._client = ClientExtensions.CreateClient(handler);
p._client.BaseAddress = p._server.BaseAddress;

}
Task.Run(async () => await p.Menu()).Wait();

static async Task RunAsync()
{
await Menu();
}

static async Task Menu()
{
while(true)
{
Console.WriteLine(
@"CacheCow Cars Samples - (ASP.NET Core MVC and HttpClient)
- Press 0 to list all cars
- Press 1 to create a new car and add to repo
- Press 2 to update the last item (updates last modified)
- Press 3 to delete the last item
- Press 4 to get the last item
- Press x to exit
"
);
var key = Console.ReadKey(true);
switch (key.KeyChar)
{
case 'x':
return;
case '0':
await ListAll();
break;
case '1':
await CreateNew();
break;
case '2':
await UpdateLast();
break;
case '3':
await DeleteLast();
break;
case '4':
await GetLast();
break;
default:
// nothing
break;
}
}
}


static async Task ListAll()
public override async Task ListAll()
{
var response = await _client.GetAsync("/api/cars");
response.EnsureSuccessStatusCode();
Expand All @@ -97,7 +55,7 @@ static async Task ListAll()
Console.ResetColor();
}

static async Task CreateNew()
public override async Task CreateNew()
{
var response = await _client.SendAsync( new HttpRequestMessage(HttpMethod.Post, "/api/car"));
response.EnsureSuccessStatusCode();
Expand All @@ -108,7 +66,7 @@ static async Task CreateNew()

}

static async Task UpdateLast()
public override async Task UpdateLast()
{
var id = InMemoryCarRepository.Instance.GetLastId();
if(id.HasValue)
Expand All @@ -125,7 +83,7 @@ static async Task UpdateLast()
}
}

static async Task DeleteLast()
public override async Task DeleteLast()
{
var id = InMemoryCarRepository.Instance.GetLastId();
if (id.HasValue)
Expand All @@ -142,7 +100,7 @@ static async Task DeleteLast()
}

}
static async Task GetLast()
public override async Task GetLast()
{
var id = InMemoryCarRepository.Instance.GetLastId();
if (id.HasValue)
Expand Down
6 changes: 6 additions & 0 deletions samples/CacheCow.Samples.WebApi/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
63 changes: 63 additions & 0 deletions samples/CacheCow.Samples.WebApi/CacheCow.Samples.WebApi.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9BAE6F47-2E77-4D20-AAA1-DDB26F23E9C1}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CacheCow.Samples.WebApi</RootNamespace>
<AssemblyName>CacheCow.Samples.WebApi</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
</Reference>
<Reference Include="System.Web.Http, Version=5.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
</Reference>
<Reference Include="System.Web.Http.SelfHost, Version=5.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
15 changes: 15 additions & 0 deletions samples/CacheCow.Samples.WebApi/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CacheCow.Samples.WebApi
{
class Program
{
static void Main(string[] args)
{
}
}
}
36 changes: 36 additions & 0 deletions samples/CacheCow.Samples.WebApi/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CacheCow.Samples.WebApi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CacheCow.Samples.WebApi")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9bae6f47-2e77-4d20-aaa1-ddb26f23e9c1")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
7 changes: 7 additions & 0 deletions samples/CacheCow.Samples.WebApi/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.5" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.5" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.SelfHost" version="5.2.5" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.5" />
<PackageReference Include="StackExchange.Redis" Version="1.2.6" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/CacheCow.Client/CacheCow.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CacheCow.Common\CacheCow.Common.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/CacheCow.Common/CacheCow.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.5" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.3" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.5" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/CacheCow.Server.WebApi/CacheCow.Server.WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CacheCow.Common\CacheCow.Common.csproj" />
Expand Down
Loading

0 comments on commit 5a35455

Please sign in to comment.