Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit d21f9cc

Browse files
author
Mathew McLoughlin
committed
Getting it working
1 parent 4109043 commit d21f9cc

7 files changed

Lines changed: 162 additions & 109 deletions

File tree

SqlStreamStore.HAL.sln

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.0.0
5-
MinimumVisualStudioVersion = 10.0.0.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlStreamStore.HAL", "SqlStreamStore.HAL/SqlStreamStore.HAL.csproj", "{A8770217-10C4-4388-8AE3-24BAF873AB9C}"
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.25807.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlStreamStore.HAL", "SqlStreamStore.HAL\SqlStreamStore.HAL.csproj", "{022329C2-F59B-4350-8242-003CE480CD84}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{A8770217-10C4-4388-8AE3-24BAF873AB9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{A8770217-10C4-4388-8AE3-24BAF873AB9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{A8770217-10C4-4388-8AE3-24BAF873AB9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{A8770217-10C4-4388-8AE3-24BAF873AB9C}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{022329C2-F59B-4350-8242-003CE480CD84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{022329C2-F59B-4350-8242-003CE480CD84}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{022329C2-F59B-4350-8242-003CE480CD84}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{022329C2-F59B-4350-8242-003CE480CD84}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE

SqlStreamStore.HAL/App.config

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
5+
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<dependentAssembly>
9+
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
10+
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
11+
</dependentAssembly>
12+
</assemblyBinding>
13+
</runtime>
14+
</configuration>

SqlStreamStore.HAL/Program.cs

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
using System;
2-
using Microsoft.Owin.Builder;
1+
using Microsoft.Owin.Builder;
32
using Microsoft.Owin.Hosting;
43
using Owin;
54
using SqlStreamStore.Streams;
5+
using System;
6+
using System.Web.Http;
67
using MidFunc = System.Func<
78
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>,
89
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>>;
910

1011
namespace SqlStreamStore.HAL
1112
{
12-
internal class Program
13+
class Program
1314
{
14-
public static void Main(string[] args)
15+
static void Main(string[] args)
1516
{
1617
var streamStore = new InMemoryStreamStore();
1718
var messages = SeedData.Get(1000);
1819

1920
streamStore.AppendToStream("SomeStream", ExpectedVersion.Any, messages);
2021

21-
var settings = new HALSettings {Url = "Stream"};
22+
var settings = new HALSettings { Url = "Stream" };
2223
var baseUrl = "http://localhost:8080";
2324

2425
using (WebApp.Start(baseUrl, app => app.Use(HALMiddleware.Handle(settings))))
@@ -29,36 +30,50 @@ public static void Main(string[] args)
2930
}
3031
}
3132

32-
public class FooMessage
33-
{
34-
}
35-
3633
internal static class HALMiddleware
3734
{
3835
public static MidFunc Handle(HALSettings settings)
3936
{
4037
return next =>
4138
{
39+
var config = new HttpConfiguration();
40+
config.Routes.MapHttpRoute(
41+
name: "SqlStreamStoreHAL",
42+
routeTemplate: settings.Url + "/{checkpoint}",
43+
defaults: new { controller = "SqlStreamStoreHAL", checkpoint = RouteParameter.Optional , action = "index" }
44+
);
45+
46+
4247
var appBuilder = new AppBuilder();
43-
appBuilder.Run(context =>
44-
{
45-
context.Response.ContentType = "text/plain";
48+
appBuilder.UseWebApi(config);
49+
//appBuilder.Run(context =>
50+
//{
51+
// context.Response.ContentType = "text/plain";
4652

47-
string output = string.Format(
48-
"I'm running on {0} nFrom assembly {1}",
49-
Environment.OSVersion,
50-
System.Reflection.Assembly.GetEntryAssembly().FullName
51-
);
53+
// string output = string.Format(
54+
// "I'm running on {0} nFrom assembly {1}",
55+
// Environment.OSVersion,
56+
// System.Reflection.Assembly.GetEntryAssembly().FullName
57+
// );
5258

53-
return context.Response.WriteAsync(output);
54-
});
59+
// return context.Response.WriteAsync(output);
60+
//});
5561
return appBuilder.Build();
5662
};
5763
}
5864
}
5965

66+
public class SqlStreamStoreHALController : ApiController
67+
{
68+
[HttpGet]
69+
public string Index()
70+
{
71+
return "test";
72+
}
73+
}
74+
6075
internal class HALSettings
6176
{
6277
public string Url { get; set; }
6378
}
64-
}
79+
}

SqlStreamStore.HAL/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,22 @@
55
// General Information about an assembly is controlled through the following
66
// set of attributes. Change these attribute values to modify the information
77
// associated with an assembly.
8-
98
[assembly: AssemblyTitle("SqlStreamStore.HAL")]
109
[assembly: AssemblyDescription("")]
1110
[assembly: AssemblyConfiguration("")]
12-
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyCompany("Microsoft")]
1312
[assembly: AssemblyProduct("SqlStreamStore.HAL")]
14-
[assembly: AssemblyCopyright("Copyright © 2016")]
13+
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
1514
[assembly: AssemblyTrademark("")]
1615
[assembly: AssemblyCulture("")]
1716

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

2422
// The following GUID is for the ID of the typelib if this project is exposed to COM
25-
26-
[assembly: Guid("A8770217-10C4-4388-8AE3-24BAF873AB9C")]
23+
[assembly: Guid("022329c2-f59b-4350-8242-003ce480cd84")]
2724

2825
// Version information for an assembly consists of the following four values:
2926
//
@@ -35,7 +32,5 @@
3532
// You can specify all the values or you can default the Build and Revision Numbers
3633
// by using the '*' as shown below:
3734
// [assembly: AssemblyVersion("1.0.*")]
38-
3935
[assembly: AssemblyVersion("1.0.0.0")]
4036
[assembly: AssemblyFileVersion("1.0.0.0")]
41-

SqlStreamStore.HAL/SeedData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static IEnumerable<NewStreamMessage> Get(int count)
2626
yield return new NewStreamMessage(
2727
Guid.NewGuid(),
2828
message.GetType().FullName.ToString(),
29-
SimpleJson.SerializeObject(new FooMessage())
29+
SimpleJson.SerializeObject(message)
3030
);
3131
}
3232
}
Lines changed: 91 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,98 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.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-
<ProjectGuid>{A8770217-10C4-4388-8AE3-24BAF873AB9C}</ProjectGuid>
8-
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
9-
<OutputType>Exe</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>SqlStreamStore.HAL</RootNamespace>
12-
<AssemblyName>SqlStreamStore.HAL</AssemblyName>
13-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14-
<FileAlignment>512</FileAlignment>
15-
</PropertyGroup>
16-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17-
<PlatformTarget>AnyCPU</PlatformTarget>
18-
<DebugSymbols>true</DebugSymbols>
19-
<DebugType>full</DebugType>
20-
<Optimize>false</Optimize>
21-
<OutputPath>bin\Debug\</OutputPath>
22-
<DefineConstants>DEBUG;TRACE</DefineConstants>
23-
<ErrorReport>prompt</ErrorReport>
24-
<WarningLevel>4</WarningLevel>
25-
</PropertyGroup>
26-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27-
<PlatformTarget>AnyCPU</PlatformTarget>
28-
<DebugType>pdbonly</DebugType>
29-
<Optimize>true</Optimize>
30-
<OutputPath>bin\Release\</OutputPath>
31-
<DefineConstants>TRACE</DefineConstants>
32-
<ErrorReport>prompt</ErrorReport>
33-
<WarningLevel>4</WarningLevel>
34-
</PropertyGroup>
35-
<ItemGroup>
36-
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
37-
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
38-
</Reference>
39-
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
40-
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
41-
</Reference>
42-
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
43-
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
44-
</Reference>
45-
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5">
46-
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
47-
</Reference>
48-
<Reference Include="SqlStreamStore, Version=0.4.3.0, Culture=neutral, PublicKeyToken=null">
49-
<HintPath>..\packages\SqlStreamStore.0.4.3\lib\Portable-Net45+Win8+WP8+WPA81\SqlStreamStore.dll</HintPath>
50-
</Reference>
51-
<Reference Include="System" />
52-
<Reference Include="System.Core" />
53-
<Reference Include="System.Xml.Linq" />
54-
<Reference Include="System.Data.DataSetExtensions" />
55-
<Reference Include="System.Data" />
56-
<Reference Include="System.Xml" />
57-
</ItemGroup>
58-
<ItemGroup>
59-
<Compile Include="Program.cs" />
60-
<Compile Include="Properties\AssemblyInfo.cs" />
61-
<Compile Include="SeedData.cs" />
62-
</ItemGroup>
63-
<ItemGroup>
64-
<Content Include="packages.config" />
65-
</ItemGroup>
66-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.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+
<ProjectGuid>{022329C2-F59B-4350-8242-003CE480CD84}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>SqlStreamStore.HAL</RootNamespace>
11+
<AssemblyName>SqlStreamStore.HAL</AssemblyName>
12+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
37+
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
38+
<Private>True</Private>
39+
</Reference>
40+
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
41+
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
42+
<Private>True</Private>
43+
</Reference>
44+
<Reference Include="Microsoft.Owin.Hosting, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
45+
<HintPath>..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
46+
<Private>True</Private>
47+
</Reference>
48+
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
49+
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
50+
<Private>True</Private>
51+
</Reference>
52+
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
53+
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
54+
<Private>True</Private>
55+
</Reference>
56+
<Reference Include="SqlStreamStore, Version=0.4.3.0, Culture=neutral, processorArchitecture=MSIL">
57+
<HintPath>..\packages\SqlStreamStore.0.4.3\lib\Portable-Net45+Win8+WP8+WPA81\SqlStreamStore.dll</HintPath>
58+
<Private>True</Private>
59+
</Reference>
60+
<Reference Include="System" />
61+
<Reference Include="System.Core" />
62+
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
63+
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
64+
<Private>True</Private>
65+
</Reference>
66+
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
67+
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
68+
<Private>True</Private>
69+
</Reference>
70+
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71+
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
72+
<Private>True</Private>
73+
</Reference>
74+
<Reference Include="System.Xml.Linq" />
75+
<Reference Include="System.Data.DataSetExtensions" />
76+
<Reference Include="Microsoft.CSharp" />
77+
<Reference Include="System.Data" />
78+
<Reference Include="System.Net.Http" />
79+
<Reference Include="System.Xml" />
80+
</ItemGroup>
81+
<ItemGroup>
82+
<Compile Include="Program.cs" />
83+
<Compile Include="Properties\AssemblyInfo.cs" />
84+
<Compile Include="SeedData.cs" />
85+
</ItemGroup>
86+
<ItemGroup>
87+
<None Include="App.config" />
88+
<None Include="packages.config" />
89+
</ItemGroup>
90+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6791
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
6892
Other similar extension points exist, see Microsoft.Common.targets.
6993
<Target Name="BeforeBuild">
7094
</Target>
7195
<Target Name="AfterBuild">
7296
</Target>
73-
-->
97+
-->
7498
</Project>

SqlStreamStore.HAL/packages.config

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
4-
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net45" />
5-
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
6-
<package id="Owin" version="1.0" targetFramework="net45" />
7-
<package id="SqlStreamStore" version="0.4.3" targetFramework="net45" />
3+
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net46" />
4+
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net46" />
5+
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net46" />
6+
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net46" />
7+
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net46" />
8+
<package id="Microsoft.Owin.Host.HttpListener" version="2.0.2" targetFramework="net46" />
9+
<package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net46" />
10+
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net46" />
11+
<package id="Owin" version="1.0" targetFramework="net46" />
12+
<package id="SqlStreamStore" version="0.4.3" targetFramework="net46" />
813
</packages>

0 commit comments

Comments
 (0)