Skip to content

Commit

Permalink
Merge pull request #686 from ProH4Ck/feature/netcore3-update
Browse files Browse the repository at this point in the history
.Net core 3 support
  • Loading branch information
rasmus authored Dec 9, 2019
2 parents fcf6f78 + 525eaa9 commit 578b2dc
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@

namespace EventFlow.AspNetCore.Configuration
{
public class EventFlowJsonOptionsMvcConfiguration : IConfigureOptions<MvcJsonOptions>
public class EventFlowJsonOptionsMvcConfiguration :
#if NETSTANDARD2_0
IConfigureOptions<MvcJsonOptions>
#endif
#if NETCOREAPP3_0
IConfigureOptions<MvcNewtonsoftJsonOptions>
#endif
{
private readonly IJsonOptions _jsonOptions;

Expand All @@ -36,9 +42,17 @@ public EventFlowJsonOptionsMvcConfiguration(IJsonOptions jsonOptions)
_jsonOptions = jsonOptions;
}

#if NETSTANDARD2_0
public void Configure(MvcJsonOptions options)
{
_jsonOptions.Apply(options.SerializerSettings);
}
#endif
#if NETCOREAPP3_0
public void Configure(MvcNewtonsoftJsonOptions options)
{
_jsonOptions.Apply(options.SerializerSettings);
}
#endif
}
}
15 changes: 12 additions & 3 deletions Source/EventFlow.AspNetCore/EventFlow.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netcoreapp3.0</TargetFrameworks>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
Expand All @@ -21,9 +21,18 @@
<PackageReleaseNotes>UPDATED BY BUILD</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19270-01" PrivateAssets="All" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,22 @@ public AspNetCoreEventFlowOptions AddDefaultMetadataProviders()
return this;
}

#if NETSTANDARD2_0
public AspNetCoreEventFlowOptions UseMvcJsonOptions()
{
_options.RegisterServices(s =>
s.Register<IConfigureOptions<MvcJsonOptions>, EventFlowJsonOptionsMvcConfiguration>());
return this;
}
#endif
#if NETCOREAPP3_0
public AspNetCoreEventFlowOptions UseMvcJsonOptions()
{
_options.RegisterServices(s =>
s.Register<IConfigureOptions<MvcNewtonsoftJsonOptions>, EventFlowJsonOptionsMvcConfiguration>());
return this;
}
#endif

public AspNetCoreEventFlowOptions UseModelBinding(
Action<EventFlowModelBindingMvcConfiguration> configureModelBinding = null)
Expand Down
2 changes: 1 addition & 1 deletion Source/EventFlow/EventFlow.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Common.props" />
<PropertyGroup>
<TargetFrameworks>net452;netstandard1.6;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net452;netstandard1.6;netstandard2.0;netcoreapp3.0</TargetFrameworks>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ environment:
EVENTFLOW_MSSQL_SERVER: (local)\SQL2017
EVENTFLOW_MSSQL_USER: sa
EVENTFLOW_MSSQL_PASS: Password12!

test: off

artifacts:
Expand Down
2 changes: 1 addition & 1 deletion up_integration-test-env.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $env:ELASTICSEARCH_URL = "http://localhost:9200"
# Event Store
$env:EVENTSTORE_URL = "tcp://admin:changeit@localhost:1113"

# Helth check
# Health checks
# Event Store
curl --connect-timeout 60 --retry 5 -sL "http://localhost:2113"
# Elasticsearch
Expand Down

0 comments on commit 578b2dc

Please sign in to comment.