Skip to content

Commit 443e039

Browse files
committed
Use MvcCore instead of Mvc
1 parent 3fc1099 commit 443e039

File tree

11 files changed

+21
-20
lines changed

11 files changed

+21
-20
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

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-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ 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;

src/Examples/NoEntityFrameworkExample/Startup.cs

+2-2
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";

src/Examples/ReportsExample/ReportsExample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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)" />

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/JsonApiDotNetCore/Controllers/JsonApiControllerMixin.cs

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

66
namespace JsonApiDotNetCore.Controllers
77
{
8-
public abstract class JsonApiControllerMixin : Controller
8+
public abstract class JsonApiControllerMixin : ControllerBase
99
{
1010
protected IActionResult UnprocessableEntity()
1111
{

src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.Controllers
88
/// <summary>
99
/// A controller to be used for bulk operations as defined in the json:api 1.1 specification
1010
/// </summary>
11-
public class JsonApiOperationsController : Controller
11+
public class JsonApiOperationsController : ControllerBase
1212
{
1313
private readonly IOperationsProcessor _operationsProcessor;
1414

src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ public static class IServiceCollectionExtensions
2323
public static IServiceCollection AddJsonApi<TContext>(this IServiceCollection services)
2424
where TContext : DbContext
2525
{
26-
var mvcBuilder = services.AddMvc();
27-
return AddJsonApi<TContext>(services, (opt) => { }, mvcBuilder);
26+
var mvcBuilder = services.AddMvcCore();
27+
return AddJsonApi<TContext>(services, opt => { }, mvcBuilder);
2828
}
2929

3030
public static IServiceCollection AddJsonApi<TContext>(this IServiceCollection services, Action<JsonApiOptions> options)
3131
where TContext : DbContext
3232
{
33-
var mvcBuilder = services.AddMvc();
33+
var mvcBuilder = services.AddMvcCore();
3434
return AddJsonApi<TContext>(services, options, mvcBuilder);
3535
}
3636

3737
public static IServiceCollection AddJsonApi<TContext>(this IServiceCollection services,
3838
Action<JsonApiOptions> options,
39-
IMvcBuilder mvcBuilder) where TContext : DbContext
39+
IMvcCoreBuilder mvcBuilder) where TContext : DbContext
4040
{
4141
var config = new JsonApiOptions();
4242

@@ -57,7 +57,7 @@ public static IServiceCollection AddJsonApi<TContext>(this IServiceCollection se
5757

5858
public static IServiceCollection AddJsonApi(this IServiceCollection services,
5959
Action<JsonApiOptions> options,
60-
IMvcBuilder mvcBuilder)
60+
IMvcCoreBuilder mvcBuilder)
6161
{
6262
var config = new JsonApiOptions();
6363

src/JsonApiDotNetCore/JsonApiDotNetCore.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
<ItemGroup>
2020
<PackageReference Include="Ben.Demystifier" Version="0.1.0" />
2121
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="$(AspNetCoreVersion)" />
22-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(AspNetCoreVersion)" />
22+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="$(AspNetCoreVersion)" />
2323
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
2424
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftLoggingVersion)" />
2525
<PackageReference Include="System.Memory" Version="4.5.0-preview2-26406-04" />
2626
<PackageReference Include="System.ValueTuple" Version="$(TuplesVersion)" />
27+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
2728
</ItemGroup>
2829

2930
<!--

0 commit comments

Comments
 (0)