Skip to content

Commit 3fc28a3

Browse files
committed
Added .NET 5.0 support
1 parent 3e29875 commit 3fc28a3

12 files changed

Lines changed: 20 additions & 13 deletions

File tree

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The **[Client Library](#client-library)** allows you to call Service Brokers tha
1313

1414
[![OpenServiceBroker.Server](https://img.shields.io/nuget/v/OpenServiceBroker.Server.svg)](https://www.nuget.org/packages/OpenServiceBroker.Server/)
1515

16-
Set up a regular ASP.NET Core 2.1 or 3.1 project and add the NuGet package [`OpenServiceBroker.Server`](https://www.nuget.org/packages/OpenServiceBroker.Server/). Then implement the following interfaces:
16+
Set up a regular ASP.NET Core 2.1, 3.1 or 5.0 project and add the NuGet package [`OpenServiceBroker.Server`](https://www.nuget.org/packages/OpenServiceBroker.Server/). Then implement the following interfaces:
1717
- [`ICatalogService`](src/Server/Catalogs/ICatalogService.cs) (optionally also [`IETagProvider`](src/Server/Catalogs/IETagProvider.cs) and/or [`ILastModifiedProvider`](src/Server/Catalogs/ILastModifiedProvider.cs) on the same class)
1818
- either [`IServiceInstanceBlocking`](src/Server/Instances/IServiceInstanceBlocking.cs) or [`IServiceInstanceDeferred`](src/Server/Instances/IServiceInstanceDeferred.cs) or both
1919
- either [`IServiceBindingBlocking`](src/Server/Bindings/IServiceBindingBlocking.cs) or [`IServiceBindingDeferred`](src/Server/Bindings/IServiceBindingDeferred.cs) or both
@@ -33,7 +33,7 @@ services.AddControllers()
3333
.AddOpenServiceBroker();
3434
```
3535

36-
You can use the **[project template](template/)** to quickly set up a pre-configured ASP.NET Core 3.1 project with `OpenServiceBroker.Server`.
36+
You can use the **[project template](template/)** to quickly set up a pre-configured ASP.NET Core 5.0 project with `OpenServiceBroker.Server`.
3737

3838
### Versioning
3939

src/Server/BrokerControllerBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected OriginatingIdentity? OriginatingIdentity
106106
{
107107
get
108108
{
109-
string headerValue = Request.Headers[OriginatingIdentity.HttpHeaderName].FirstOrDefault();
109+
string? headerValue = Request.Headers[OriginatingIdentity.HttpHeaderName].FirstOrDefault();
110110
return string.IsNullOrEmpty(headerValue) ? null : OriginatingIdentity.Parse(headerValue);
111111
}
112112
}

src/Server/MvcBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static IMvcBuilder AddOpenServiceBroker(this IMvcBuilder builder)
2020
{
2121
builder.AddApplicationPart(typeof(CatalogController).Assembly);
2222

23-
#if NETCOREAPP3_1
23+
#if !NETSTANDARD2_0
2424
builder.AddNewtonsoftJson();
2525
#endif
2626

src/Server/Server.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<AssemblyName>OpenServiceBroker.Server</AssemblyName>
66
<RootNamespace>OpenServiceBroker</RootNamespace>
77
<LangVersion>8.0</LangVersion>
8-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
8+
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
99
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1010
<GenerateDocumentationFile>True</GenerateDocumentationFile>
1111
<NoWarn>$(NoWarn);1591</NoWarn>
@@ -49,5 +49,9 @@
4949
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.11" />
5050
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.11" />
5151
</ItemGroup>
52+
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
53+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
54+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
55+
</ItemGroup>
5256

5357
</Project>

src/UnitTests/FactsBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected FactsBase()
2626
.AddMvc()
2727
.AddOpenServiceBroker())
2828
.Configure(x => x.UseMvc()));
29-
#elif NETCOREAPP3_1
29+
#else
3030
.ConfigureServices(x
3131
=> x.AddScoped(_ => Mock.Object)
3232
.AddControllers()

src/UnitTests/UnitTests.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<AssemblyName>OpenServiceBroker.UnitTests</AssemblyName>
66
<RootNamespace>OpenServiceBroker</RootNamespace>
77
<LangVersion>8.0</LangVersion>
8-
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
8+
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
99
<OutputType>Library</OutputType>
1010
<IsPackable>False</IsPackable>
1111
<DeterministicSourcePaths>False</DeterministicSourcePaths>
@@ -32,6 +32,9 @@
3232
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
3333
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.9" />
3434
</ItemGroup>
35+
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
36+
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.2" />
37+
</ItemGroup>
3538

3639
<!-- Mark as unit test project -->
3740
<ItemGroup>

src/build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Run-DotNet {
66
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
77
dotnet @args
88
} else {
9-
..\0install.ps1 run --batch --version 3.1..!3.2 https://apps.0install.net/dotnet/core-sdk.xml @args
9+
..\0install.ps1 run --batch --version 5.0..!5.1 https://apps.0install.net/dotnet/core-sdk.xml @args
1010
}
1111
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
1212
}

src/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cd `dirname $0`
66
if command -v dotnet > /dev/null 2> /dev/null; then
77
dotnet="dotnet"
88
else
9-
dotnet="../0install.sh run --version 3.1..!3.2 https://apps.0install.net/dotnet/core-sdk.xml"
9+
dotnet="../0install.sh run --version 5.0..!5.1 https://apps.0install.net/dotnet/core-sdk.xml"
1010
fi
1111

1212
# Build

src/test.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Run-DotNet {
55
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
66
dotnet @args
77
} else {
8-
..\0install.ps1 run --batch --version 3.1..!3.2 https://apps.0install.net/dotnet/core-sdk.xml @args
8+
..\0install.ps1 run --batch --version 5.0..!5.1 https://apps.0install.net/dotnet/core-sdk.xml @args
99
}
1010
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
1111
}

src/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cd `dirname $0`
66
if command -v dotnet > /dev/null 2> /dev/null; then
77
dotnet="dotnet"
88
else
9-
dotnet="../0install.sh run --version 3.1..!3.2 https://apps.0install.net/dotnet/core-sdk.xml"
9+
dotnet="../0install.sh run --version 5.0..!5.1 https://apps.0install.net/dotnet/core-sdk.xml"
1010
fi
1111

1212
# Unit tests

0 commit comments

Comments
 (0)