Skip to content

Commit 9472dd4

Browse files
authored
Merge pull request #311 from json-api-dotnet/master
update develop
2 parents 21f4f46 + 8f7f0f7 commit 9472dd4

File tree

59 files changed

+365
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+365
-244
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: csharp
22
dist: trusty
33
sudo: required
4-
services:
4+
services:
55
- postgresql
66
before_script:
77
- psql -c 'create database JsonApiDotNetCoreExample;' -U postgres
88
mono: none
9-
dotnet: 2.1.105 # https://www.microsoft.com/net/download/linux
9+
dotnet: 2.1.300 # https://www.microsoft.com/net/download/linux
1010
branches:
1111
only:
1212
- master

Directory.Build.props

+13-14
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,27 @@
44
<NetCoreAppVersion>netcoreapp2.0</NetCoreAppVersion>
55
<NetStandardVersion>netstandard2.0</NetStandardVersion>
66

7-
<AspNetCoreVersion>2.0.1</AspNetCoreVersion>
7+
<AspNetCoreVersion>2.1.0</AspNetCoreVersion>
88

9-
<MicrosoftLoggingVersion>2.0.0</MicrosoftLoggingVersion>
10-
<MicrosoftConfigurationVersion>2.0.0</MicrosoftConfigurationVersion>
11-
<MicrosoftOptionsVersion>2.0.0</MicrosoftOptionsVersion>
9+
<MicrosoftLoggingVersion>2.1.0</MicrosoftLoggingVersion>
10+
<MicrosoftConfigurationVersion>2.1.0</MicrosoftConfigurationVersion>
11+
<MicrosoftOptionsVersion>2.1.0</MicrosoftOptionsVersion>
1212

13-
<EFCoreVersion>2.0.1</EFCoreVersion>
14-
<EFCoreToolsVersion>2.0.1</EFCoreToolsVersion>
13+
<EFCoreVersion>2.1.0</EFCoreVersion>
14+
<EFCoreToolsVersion>2.1.0</EFCoreToolsVersion>
1515

16-
<NpgsqlVersion>3.2.6</NpgsqlVersion>
17-
<NpgsqlPostgreSQLVersion>2.0.0</NpgsqlPostgreSQLVersion>
16+
<NpgsqlVersion>4.0.0</NpgsqlVersion>
17+
<NpgsqlPostgreSQLVersion>2.1.0</NpgsqlPostgreSQLVersion>
1818

19-
<TuplesVersion>4.4.0</TuplesVersion>
19+
<TuplesVersion>4.5.0</TuplesVersion>
2020
</PropertyGroup>
2121

2222
<!-- Test Project Dependencies -->
2323
<PropertyGroup>
24-
<TestSdkVersion>15.3.0-preview-20170427-09</TestSdkVersion>
25-
<TestHostVersion>1.1.2</TestHostVersion>
26-
<XUnitVersion>2.3.0-beta3-build3705</XUnitVersion>
27-
<BogusVersion>15.0.3</BogusVersion>
28-
<MoqVersion>4.7.99</MoqVersion>
24+
<TestSdkVersion>15.7.2</TestSdkVersion>
25+
<XUnitVersion>2.3.1</XUnitVersion>
26+
<BogusVersion>22.1.2</BogusVersion>
27+
<MoqVersion>4.8.3</MoqVersion>
2928
</PropertyGroup>
3029

3130
</Project>

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ These are some steps you can take to help you understand what this project is an
2020
- [The json:api specification](http://jsonapi.org/format/)
2121
- [Demo [Video]](https://youtu.be/KAMuo6K7VcE)
2222
- [Our documentation](https://json-api-dotnet.github.io)
23-
- Check out the examples in the next section
23+
- [Check out the example projects](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples)
24+
25+
## Related Projects
26+
27+
- [Performance Reports](https://github.com/json-api-dotnet/PerformanceReports)
28+
- [JsonApiDotNetCore.MongoDb](https://github.com/json-api-dotnet/JsonApiDotNetCore.MongoDb)
29+
- [JsonApiDotNetCore.Marten](https://github.com/wayne-o/JsonApiDotNetCore.Marten)
30+
- [Todo List App](https://github.com/json-api-dotnet/TodoListExample)
2431

2532
## Examples
2633

benchmarks/Benchmarks.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<AssemblyName>Benchmarks</AssemblyName>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageReference Include="BenchmarkDotNet" Version="0.10.10" />
8+
<PackageReference Include="BenchmarkDotNet" Version="0.10.14" />
99
<PackageReference Include="moq" Version="$(MoqVersion)" />
1010
<PackageReference Include="xunit" Version="$(xUnitVersion)" />
1111
</ItemGroup>
1212
<ItemGroup>
13-
<ProjectReference Include="..\src\JsonApiDotNetCore\JsonApiDotNetCore.csproj" />
13+
<ProjectReference Include="../src/JsonApiDotNetCore/JsonApiDotNetCore.csproj" />
1414
</ItemGroup>
1515
</Project>

src/Examples/JsonApiDotNetCoreExample/Controllers/Restricted/ReadOnlyController.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace JsonApiDotNetCoreExample.Controllers.Restricted
55
{
66
[Route("[controller]")]
77
[HttpReadOnly]
8-
public class ReadOnlyController : Controller
8+
public class ReadOnlyController : ControllerBase
99
{
1010
[HttpGet]
1111
public IActionResult Get() => Ok();
@@ -22,7 +22,7 @@ public class ReadOnlyController : Controller
2222

2323
[Route("[controller]")]
2424
[NoHttpPost]
25-
public class NoHttpPostController : Controller
25+
public class NoHttpPostController : ControllerBase
2626
{
2727
[HttpGet]
2828
public IActionResult Get() => Ok();
@@ -39,7 +39,7 @@ public class NoHttpPostController : Controller
3939

4040
[Route("[controller]")]
4141
[NoHttpPatch]
42-
public class NoHttpPatchController : Controller
42+
public class NoHttpPatchController : ControllerBase
4343
{
4444
[HttpGet]
4545
public IActionResult Get() => Ok();
@@ -56,7 +56,7 @@ public class NoHttpPatchController : Controller
5656

5757
[Route("[controller]")]
5858
[NoHttpDelete]
59-
public class NoHttpDeleteController : Controller
59+
public class NoHttpDeleteController : ControllerBase
6060
{
6161
[HttpGet]
6262
public IActionResult Get() => Ok();

src/Examples/JsonApiDotNetCoreExample/Controllers/TestValuesController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace JsonApiDotNetCoreExample.Controllers
44
{
55
[Route("[controller]")]
6-
public class TestValuesController : Controller
6+
public class TestValuesController : ControllerBase
77
{
88
[HttpGet]
99
public IActionResult Get()

src/Examples/JsonApiDotNetCoreExample/Controllers/TodoItemsCustomController.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@ public CustomJsonApiController(
3333
}
3434

3535
public class CustomJsonApiController<T, TId>
36-
: Controller where T : class, IIdentifiable<TId>
36+
: ControllerBase where T : class, IIdentifiable<TId>
3737
{
3838
private readonly ILogger _logger;
3939
private readonly IResourceService<T, TId> _resourceService;
4040
private readonly IJsonApiContext _jsonApiContext;
4141

42-
protected IActionResult UnprocessableEntity()
43-
{
44-
return new StatusCodeResult(422);
45-
}
46-
4742
protected IActionResult Forbidden()
4843
{
4944
return new StatusCodeResult(403);

src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,4 @@
2626
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
2727
</ItemGroup>
2828

29-
<ItemGroup>
30-
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="$(EFCoreToolsVersion)" />
31-
</ItemGroup>
32-
3329
</Project>

src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.Designer.cs

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
using Microsoft.EntityFrameworkCore.Metadata;
1+
using Microsoft.EntityFrameworkCore.Metadata;
22
using Microsoft.EntityFrameworkCore.Migrations;
33
using System;
44
using System.Collections.Generic;
5+
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
56

67
namespace JsonApiDotNetCoreExample.Migrations
78
{

src/Examples/JsonApiDotNetCoreExample/Migrations/AppDbContextModelSnapshot.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <auto-generated />
1+
// <auto-generated />
22
using JsonApiDotNetCoreExample.Data;
33
using Microsoft.EntityFrameworkCore;
44
using Microsoft.EntityFrameworkCore.Infrastructure;
@@ -7,6 +7,7 @@
77
using Microsoft.EntityFrameworkCore.Storage;
88
using Microsoft.EntityFrameworkCore.Storage.Internal;
99
using System;
10+
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
1011

1112
namespace JsonApiDotNetCoreExample.Migrations
1213
{

src/Examples/JsonApiDotNetCoreExample/Startup.cs

+11-15
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,17 @@ public Startup(IHostingEnvironment env)
2828
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
2929
{
3030
var loggerFactory = new LoggerFactory();
31-
loggerFactory.AddConsole(LogLevel.Trace);
32-
services.AddSingleton<ILoggerFactory>(loggerFactory);
31+
loggerFactory.AddConsole(LogLevel.Warning);
3332

34-
services.AddDbContext<AppDbContext>(options =>
35-
{
36-
options.UseNpgsql(GetDbConnectionString());
37-
}, ServiceLifetime.Transient);
38-
39-
services.AddJsonApi<AppDbContext>(opt =>
40-
{
41-
opt.Namespace = "api/v1";
42-
opt.DefaultPageSize = 5;
43-
opt.IncludeTotalRecordCount = true;
44-
});
33+
services
34+
.AddSingleton<ILoggerFactory>(loggerFactory)
35+
.AddDbContext<AppDbContext>(options =>
36+
options.UseNpgsql(GetDbConnectionString()), ServiceLifetime.Transient)
37+
.AddJsonApi<AppDbContext>(options => {
38+
options.Namespace = "api/v1";
39+
options.DefaultPageSize = 5;
40+
options.IncludeTotalRecordCount = true;
41+
});
4542

4643
var provider = services.BuildServiceProvider();
4744
var appContext = provider.GetRequiredService<AppDbContext>();
@@ -60,11 +57,10 @@ public virtual void Configure(
6057
context.Database.EnsureCreated();
6158

6259
loggerFactory.AddConsole(Config.GetSection("Logging"));
63-
loggerFactory.AddDebug();
6460

6561
app.UseJsonApi();
6662
}
6763

6864
public string GetDbConnectionString() => Config["Data:DefaultConnection"];
6965
}
70-
}
66+
}

src/Examples/JsonApiDotNetCoreExample/appsettings.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"Logging": {
66
"IncludeScopes": false,
77
"LogLevel": {
8-
"Default": "Trace",
9-
"System": "Trace",
10-
"Microsoft": "Trace"
8+
"Default": "Warning",
9+
"System": "Warning",
10+
"Microsoft": "Warning"
1111
}
1212
}
1313
}

src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftLoggingVersion)" />
1919
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
2020
<PackageReference Include="Npgsql" Version="$(NpgsqlVersion)" />
21-
<PackageReference Include="Dapper" Version="1.50.2" />
21+
<PackageReference Include="Dapper" Version="1.50.5" />
2222
</ItemGroup>
2323

2424
</Project>

src/Examples/NoEntityFrameworkExample/Startup.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using JsonApiDotNetCore.Extensions;
1+
using JsonApiDotNetCore.Extensions;
22
using JsonApiDotNetCore.Services;
33
using JsonApiDotNetCoreExample.Data;
44
using JsonApiDotNetCoreExample.Models;
@@ -31,7 +31,7 @@ public Startup(IHostingEnvironment env)
3131
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
3232
{
3333
// Add framework services.
34-
var mvcBuilder = services.AddMvc();
34+
var mvcBuilder = services.AddMvcCore();
3535

3636
services.AddJsonApi(options => {
3737
options.Namespace = "api/v1";
@@ -55,7 +55,6 @@ public virtual IServiceProvider ConfigureServices(IServiceCollection services)
5555
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, AppDbContext context)
5656
{
5757
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
58-
loggerFactory.AddDebug();
5958

6059
context.Database.EnsureCreated();
6160

src/Examples/OperationsExample/OperationsExample.csproj

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<ItemGroup>
1010
<ProjectReference Include="../../JsonApiDotNetCore/JsonApiDotNetCore.csproj" />
11-
<ProjectReference Include="..\JsonApiDotNetCoreExample\JsonApiDotNetCoreExample.csproj" />
11+
<ProjectReference Include="../JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
@@ -27,8 +27,4 @@
2727
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
2828
</ItemGroup>
2929

30-
<ItemGroup>
31-
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="$(EFCoreToolsVersion)" />
32-
</ItemGroup>
33-
3430
</Project>

src/Examples/OperationsExample/Startup.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public Startup(IHostingEnvironment env)
2727
public virtual IServiceProvider ConfigureServices(IServiceCollection services)
2828
{
2929
var loggerFactory = new LoggerFactory();
30-
loggerFactory.AddConsole(LogLevel.Trace);
30+
loggerFactory.AddConsole(LogLevel.Warning);
3131

3232
services.AddSingleton<ILoggerFactory>(loggerFactory);
3333

@@ -47,7 +47,6 @@ public virtual void Configure(
4747
context.Database.EnsureCreated();
4848

4949
loggerFactory.AddConsole(Config.GetSection("Logging"));
50-
loggerFactory.AddDebug();
5150
app.UseJsonApi();
5251
}
5352

src/Examples/OperationsExample/appsettings.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"Logging": {
66
"IncludeScopes": false,
77
"LogLevel": {
8-
"Default": "Trace",
9-
"System": "Trace",
10-
"Microsoft": "Trace"
8+
"Default": "Warning",
9+
"System": "Warning",
10+
"Microsoft": "Warning"
1111
}
1212
}
1313
}

src/Examples/ReportsExample/ReportsExample.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.AspNetCore" Version="$(AspNetCoreVersion)" />
16-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(AspNetCoreVersion)" />
16+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="$(AspNetCoreVersion)" />
1717
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftLoggingVersion)" />
1818
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(NpgsqlPostgreSQLVersion)" />
1919
<PackageReference Include="Npgsql" Version="$(NpgsqlVersion)" />
20-
<PackageReference Include="Dapper" Version="1.50.2" />
20+
<PackageReference Include="Dapper" Version="1.50.5" />
2121
</ItemGroup>
2222

2323
</Project>

src/Examples/ReportsExample/Startup.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public Startup(IHostingEnvironment env)
2525

2626
public virtual void ConfigureServices(IServiceCollection services)
2727
{
28-
var mvcBuilder = services.AddMvc();
28+
var mvcBuilder = services.AddMvcCore();
2929
services.AddJsonApi(opt =>
3030
{
3131
opt.BuildContextGraph(builder =>

src/Examples/ReportsExample/appsettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Logging": {
33
"IncludeScopes": false,
44
"LogLevel": {
5-
"Default": "Information"
5+
"Default": "Warning"
66
}
77
}
88
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
51
namespace JsonApiDotNetCore.Builders
62
{
73
public interface IDocumentBuilderOptionsProvider
84
{
9-
DocumentBuilderOptions GetDocumentBuilderOptions();
5+
DocumentBuilderOptions GetDocumentBuilderOptions();
106
}
117
}

0 commit comments

Comments
 (0)