Permalink
Browse files

Updated project to support netstandard 2.0 and netstandard1.3

  • Loading branch information...
Soarc committed Aug 19, 2017
1 parent b351968 commit 92ca7df3a7e72f629917ced8416e03205e17dcd8
@@ -40,3 +40,5 @@ _ReSharper*
#ignore codegen stuff
orleans.codegen.cs
/.vs
@@ -1,114 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C75CFE26-E263-470A-A494-AEB3CE9E8187}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Example</RootNamespace>
<AssemblyName>Example</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<TargetFramework>netcoreapp2.0</TargetFramework>
</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="Microsoft.Azure.KeyVault.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.KeyVault.Core.2.0.4\lib\net45\Microsoft.Azure.KeyVault.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.Edm, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Data.Edm.5.8.2\lib\net40\Microsoft.Data.Edm.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.OData, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Data.OData.5.8.2\lib\net40\Microsoft.Data.OData.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.Services.Client, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Data.Services.Client.5.8.2\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Configuration, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=8.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\WindowsAzure.Storage.8.1.1\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Spatial, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Spatial.5.8.2\lib\net40\System.Spatial.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Model.cs" />
<Compile Include="Scenarios\S06_Include_additional_entities.cs" />
<Compile Include="Program.cs" />
<Compile Include="Scenario.cs" />
<Compile Include="Scenarios\S01_Provision_new_stream.cs" />
<Compile Include="Scenarios\S02_Open_stream_for_writing.cs" />
<Compile Include="Scenarios\S03_Try_open_stream_for_writing.cs" />
<Compile Include="Scenarios\S04_Write_to_stream.cs" />
<Compile Include="Scenarios\S11_Sharding_streams.cs" />
<Compile Include="Scenarios\S10_Stream_directory.cs" />
<Compile Include="Scenarios\S09_Handling_duplicates.cs" />
<Compile Include="Scenarios\S08_Concurrency_conflicts.cs" />
<Compile Include="Scenarios\S07_Custom_stream_metadata.cs" />
<Compile Include="Scenarios\S05_Read_from_stream.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Streamstone\Streamstone.csproj">
<Project>{944568EA-BC0B-49BC-AF0F-B4A4A62858AC}</Project>
<Name>Streamstone</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<ProjectReference Include="..\Streamstone\Streamstone.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

This file was deleted.

Oops, something went wrong.
@@ -1,18 +1,16 @@
using System;
using System.Linq;
using Example.Scenarios;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using System;
using System.Threading.Tasks;
namespace Example
{
using Scenarios;
public static class Program
class Program
{
public static void Main()
static void Main(string[] args)
{
var table = Prepare();
var table = Prepare().Result;
var scenarios = new Scenario[]
{
@@ -32,7 +30,7 @@ public static void Main()
for (var i = 0; i < scenarios.Length; i++)
{
var scenario = scenarios[i];
var scenarioName = scenario.GetType().Name;
var scenarioName = scenario.GetType().Name;
Console.WriteLine("{0}", scenarioName.Replace("_", " "));
Console.WriteLine(new string('-', 40));
@@ -48,15 +46,15 @@ public static void Main()
Console.ReadKey(true);
}
static CloudTable Prepare()
static async Task<CloudTable> Prepare()
{
var table = CloudStorageAccount
.DevelopmentStorageAccount
.CreateCloudTableClient()
.GetTableReference("Example");
table.DeleteIfExists();
table.CreateIfNotExists();
await table.DeleteIfExistsAsync();
await table.CreateIfNotExistsAsync();
return table;
}
@@ -34,11 +34,15 @@ void MultipleStreamsPerPartitionUsingStreamProperties()
// the below code will scan all rows in a single physical partition
// also, if there more than 1000 streams (header rows), pagination need to be utilized as per regular ATS limits
var count = Partition.Table.CreateQuery<StreamHeaderEntity>()
.Where(x => x.PartitionKey == Partition.PartitionKey &&
x.RowType == "STREAM")
.ToList()
.Count();
var filter = TableQuery.CombineFilters(
// x.PartitionKey == Partition.PartitionKey
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, Partition.PartitionKey),
TableOperators.And,
// x.RowType == "STREAM"
TableQuery.GenerateFilterCondition(nameof(StreamHeaderEntity.RowType), QueryComparisons.Equal, "STREAM")
);
var count = Partition.Table.ExecuteQuery<StreamHeaderEntity>(filter).Count();
Console.WriteLine(count);
}
@@ -128,7 +132,7 @@ class EventStore
public EventStore(Partition directory)
{
this.directory = directory;
this.directory.Table.CreateIfNotExists();
this.directory.Table.CreateIfNotExistsAsync().Wait();
}
public Stream Provision(Partition partition)
@@ -148,17 +152,17 @@ public StreamWriteResult Write(Stream stream, params EventData[] events)
void Record(Partition partition)
{
var header = new DynamicTableEntity(directory.PartitionKey, partition.ToString());
directory.Table.Execute(TableOperation.Insert(header));
directory.Table.ExecuteAsync(TableOperation.Insert(header)).Wait();
}
public IEnumerable<string> Streams()
{
// NOTE: if there more than 1000 streams (header rows) in directory,
// pagination need to be implemented as per regular ATS limits
var filter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, directory.PartitionKey);
return directory.Table.CreateQuery<DynamicTableEntity>()
.Where(x => x.PartitionKey == directory.PartitionKey)
.ToArray()
return directory.Table.ExecuteQuery<DynamicTableEntity>(filter)
.Select(x => x.RowKey);
}
}

This file was deleted.

Oops, something went wrong.
@@ -1,5 +1,6 @@
using NUnit.Framework;
using Microsoft.WindowsAzure.Storage.Table;
using System.Threading.Tasks;
namespace Streamstone.Scenarios
{
@@ -17,14 +18,14 @@ public void SetUp()
}
[Test]
public async void When_stream_does_exists()
public async Task When_stream_does_exists()
{
await Stream.ProvisionAsync(partition);
Assert.True(await Stream.ExistsAsync(partition));
}
[Test]
public async void When_stream_does_not_exist()
public async Task When_stream_does_not_exist()
{
Assert.False(await Stream.ExistsAsync(partition));
}
@@ -4,6 +4,8 @@
using NUnit.Framework;
using Microsoft.WindowsAzure.Storage.Table;
using Streamstone.Utility;
using System.Threading.Tasks;
namespace Streamstone.Scenarios
{
@@ -48,7 +50,7 @@ public void When_include_has_no_conflicts_happy_path()
}
[Test]
public async void When_include_has_conflict()
public async Task When_include_has_conflict()
{
var entity = new TestEntity("INV-0001");
var include = Include.Insert(entity);
@@ -60,12 +62,12 @@ public async void When_include_has_conflict()
include = Include.Insert(entity);
events = new[] {CreateEvent("e3", include)};
Assert.Throws<IncludedOperationConflictException>(
Assert.ThrowsAsync<IncludedOperationConflictException>(
async ()=> await Stream.WriteAsync(result.Stream, events));
}
[Test]
public async void When_include_has_conflict_and_also_duplicate_event_conflict()
public async Task When_include_has_conflict_and_also_duplicate_event_conflict()
{
var entity = new TestEntity("INV-0001");
var include = Include.Insert(entity);
@@ -77,12 +79,12 @@ public async void When_include_has_conflict_and_also_duplicate_event_conflict()
include = Include.Insert(entity);
events = new[] {CreateEvent("e1", include)};
Assert.Throws<DuplicateEventException>(
Assert.ThrowsAsync<DuplicateEventException>(
async () => await Stream.WriteAsync(result.Stream, events));
}
[Test]
public async void When_include_has_conflict_and_also_stream_header_has_changed_since_last_read()
public async Task When_include_has_conflict_and_also_stream_header_has_changed_since_last_read()
{
var entity = new TestEntity("INV-0001");
var include = Include.Insert(entity);
@@ -96,12 +98,12 @@ public async void When_include_has_conflict_and_also_stream_header_has_changed_s
include = Include.Insert(entity);
events = new[] {CreateEvent("e3", include)};
Assert.Throws<ConcurrencyConflictException>(
Assert.ThrowsAsync<ConcurrencyConflictException>(
async () => await Stream.WriteAsync(result.Stream, events));
}
[Test]
public async void When_in_total_with_includes_is_over_WATS_max_batch_size_limit()
public async Task When_in_total_with_includes_is_over_WATS_max_batch_size_limit()
{
var stream = new Stream(partition);
@@ -140,17 +142,18 @@ public void When_single_event_along_with_includes_is_over_WATS_max_batch_size_li
EventIncludes.From(includes)
);
Assert.Throws<InvalidOperationException>(
Assert.ThrowsAsync<InvalidOperationException>(
async ()=> await Stream.WriteAsync(stream, @event));
}
TestEntity RetrieveTestEntity(string rowKey)
{
return table.CreateQuery<TestEntity>()
.Where(x =>
x.PartitionKey == partition.PartitionKey
&& x.RowKey == rowKey)
.ToList()
var filter = TableQuery.CombineFilters(
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partition.PartitionKey),
TableOperators.And,
TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, rowKey));
return table.ExecuteQuery<TestEntity>(filter)
.SingleOrDefault();
}
Oops, something went wrong.

0 comments on commit 92ca7df

Please sign in to comment.