From e7dc01843e3d11ce780baed098c982263bbadf81 Mon Sep 17 00:00:00 2001 From: jaredcnance Date: Sun, 10 Jun 2018 12:38:43 -0500 Subject: [PATCH 01/14] test(spec): can create hasOne relationship with resource --- .../Acceptance/Spec/CreatingDataTests.cs | 61 ++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/CreatingDataTests.cs b/test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/CreatingDataTests.cs index 2c71275473..015d79cdbd 100644 --- a/test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/CreatingDataTests.cs +++ b/test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/CreatingDataTests.cs @@ -106,7 +106,7 @@ public async Task Cannot_Create_Entity_With_Client_Generate_Id() attributes = new { description = todoItem.Description, - ordinal = todoItem.Ordinal, + ordinal = todoItem.Ordinal, createdDate = DateTime.Now } } @@ -174,7 +174,7 @@ public async Task Can_Create_Guid_Identifiable_Entity_With_Client_Defined_Id_If_ var httpMethod = new HttpMethod("POST"); var server = new TestServer(builder); var client = server.CreateClient(); - + var context = _fixture.GetService(); var owner = new JsonApiDotNetCoreExample.Models.Person(); @@ -285,6 +285,63 @@ public async Task Can_Create_And_Set_HasMany_Relationships() Assert.NotEmpty(contextCollection.TodoItems); } + [Fact] + public async Task Can_Create_And_Set_HasOne_Relationships() + { + // arrange + var builder = new WebHostBuilder() + .UseStartup(); + var httpMethod = new HttpMethod("POST"); + var server = new TestServer(builder); + var client = server.CreateClient(); + + var context = _fixture.GetService(); + + var todoItem = new TodoItem(); + var owner = new JsonApiDotNetCoreExample.Models.Person(); + context.People.Add(owner); + await context.SaveChangesAsync(); + + var route = "/api/v1/todo-items"; + var request = new HttpRequestMessage(httpMethod, route); + var content = new + { + data = new + { + type = "todo-items", + relationships = new Dictionary + { + { "owner", new { + data = new + { + type = "people", + id = owner.Id.ToString() + } + } } + } + } + }; + + request.Content = new StringContent(JsonConvert.SerializeObject(content)); + request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.api+json"); + + // act + var response = await client.SendAsync(request); + var body = await response.Content.ReadAsStringAsync(); + + // assert + Assert.Equal(HttpStatusCode.Created, response.StatusCode); + var deserializedBody = (TodoItem)_fixture.GetService().Deserialize(body); + var newId = deserializedBody.Id; + + context = _fixture.GetService(); + var todoItemResult = context.TodoItems + .Include(c => c.Owner) + .SingleOrDefault(c => c.Id == newId); + + Assert.Equal(owner.Id, todoItemResult.OwnerId); + } + [Fact] public async Task ShouldReceiveLocationHeader_InResponse() { From 99ce78ec5a8226e775120ba76d11cd2c5affe42b Mon Sep 17 00:00:00 2001 From: jaredcnance Date: Mon, 11 Jun 2018 21:33:09 -0500 Subject: [PATCH 02/14] docs(*): add xml comments --- .../IDocumentBuilderOptionsProvider.cs | 6 +-- .../NullAttributeResponseBehavior.cs | 25 +++++++-- src/JsonApiDotNetCore/Models/AttrAttribute.cs | 53 ++++++++++++++++++- .../Models/HasManyAttribute.cs | 26 ++++++++- .../Services/QueryComposer.cs | 5 +- 5 files changed, 100 insertions(+), 15 deletions(-) diff --git a/src/JsonApiDotNetCore/Builders/IDocumentBuilderOptionsProvider.cs b/src/JsonApiDotNetCore/Builders/IDocumentBuilderOptionsProvider.cs index d8effd4fe3..fe014bced5 100644 --- a/src/JsonApiDotNetCore/Builders/IDocumentBuilderOptionsProvider.cs +++ b/src/JsonApiDotNetCore/Builders/IDocumentBuilderOptionsProvider.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Text; - namespace JsonApiDotNetCore.Builders { public interface IDocumentBuilderOptionsProvider { - DocumentBuilderOptions GetDocumentBuilderOptions(); + DocumentBuilderOptions GetDocumentBuilderOptions(); } } diff --git a/src/JsonApiDotNetCore/Configuration/NullAttributeResponseBehavior.cs b/src/JsonApiDotNetCore/Configuration/NullAttributeResponseBehavior.cs index 1b10140f5e..125d38b5fc 100644 --- a/src/JsonApiDotNetCore/Configuration/NullAttributeResponseBehavior.cs +++ b/src/JsonApiDotNetCore/Configuration/NullAttributeResponseBehavior.cs @@ -1,19 +1,34 @@ -using System; -using System.Collections.Generic; -using System.Text; - namespace JsonApiDotNetCore.Configuration { + /// + /// Allows null attributes to be ommitted from the response payload + /// public struct NullAttributeResponseBehavior { + /// Do not serialize null attributes + /// + /// Allow clients to override the serialization behavior through a query parmeter. + /// + /// ``` + /// GET /articles?omitNullValuedAttributes=true + /// ``` + /// + /// public NullAttributeResponseBehavior(bool omitNullValuedAttributes = false, bool allowClientOverride = false) { OmitNullValuedAttributes = omitNullValuedAttributes; AllowClientOverride = allowClientOverride; } + /// + /// Do not include null attributes in the response payload. + /// public bool OmitNullValuedAttributes { get; } + + /// + /// Allows clients to specify a `omitNullValuedAttributes` boolean query param to control + /// serialization behavior. + /// public bool AllowClientOverride { get; } - // ... } } diff --git a/src/JsonApiDotNetCore/Models/AttrAttribute.cs b/src/JsonApiDotNetCore/Models/AttrAttribute.cs index db61cb56ea..e38b47abec 100644 --- a/src/JsonApiDotNetCore/Models/AttrAttribute.cs +++ b/src/JsonApiDotNetCore/Models/AttrAttribute.cs @@ -5,6 +5,26 @@ namespace JsonApiDotNetCore.Models { public class AttrAttribute : Attribute { + /// + /// Defines a public attribute exposed by the API + /// + /// + /// How this attribute is exposed through the API + /// Prevent PATCH requests from updating the value + /// Prevent filters on this attribute + /// Prevent this attribute from being sorted by + /// + /// + /// + /// + /// public class Author : Identifiable + /// { + /// [Attr("name")] + /// public string Name { get; set; } + /// } + /// + /// + /// public AttrAttribute(string publicName, bool isImmutable = false, bool isFilterable = true, bool isSortable = true) { PublicAttributeName = publicName; @@ -20,20 +40,51 @@ internal AttrAttribute(string publicName, string internalName, bool isImmutable IsImmutable = isImmutable; } + /// + /// How this attribute is exposed through the API + /// public string PublicAttributeName { get; } + + /// + /// The internal property name this attribute belongs to. + /// public string InternalAttributeName { get; internal set; } + + /// + /// Prevents PATCH requests from updating the value. + /// public bool IsImmutable { get; } + + /// + /// Whether or not this attribute can be filtered on via a query string filters. + /// Attempts to filter on an attribute with `IsFilterable == false` will return + /// an HTTP 400 response. + /// public bool IsFilterable { get; } + + /// + /// Whether or not this attribute can be sorted on via a query string sort. + /// Attempts to filter on an attribute with `IsSortable == false` will return + /// an HTTP 400 response. + /// public bool IsSortable { get; } + /// + /// Get the value of the attribute for the given object. + /// Returns null if the attribute does not belong to the + /// provided object. + /// public object GetValue(object entity) { return entity .GetType() .GetProperty(InternalAttributeName) - .GetValue(entity); + ?.GetValue(entity); } + /// + /// Sets the value of the attribute on the given object. + /// public void SetValue(object entity, object newValue) { var propertyInfo = entity diff --git a/src/JsonApiDotNetCore/Models/HasManyAttribute.cs b/src/JsonApiDotNetCore/Models/HasManyAttribute.cs index c2d7594400..877df29146 100644 --- a/src/JsonApiDotNetCore/Models/HasManyAttribute.cs +++ b/src/JsonApiDotNetCore/Models/HasManyAttribute.cs @@ -2,16 +2,40 @@ namespace JsonApiDotNetCore.Models { public class HasManyAttribute : RelationshipAttribute { + /// + /// Create a HasMany relational link to another entity + /// + /// + /// The relationship name as exposed by the API + /// Which links are available. Defaults to + /// Whether or not this relationship can be included using the ?include=public-name query string + /// + /// + /// + /// + /// public class Author : Identifiable + /// { + /// [HasMany("articles"] + /// public virtual List
Articles { get; set; } + /// } + /// + /// + /// public HasManyAttribute(string publicName, Link documentLinks = Link.All, bool canInclude = true) : base(publicName, documentLinks, canInclude) { } + /// + /// Sets the value of the property identified by this attribute + /// + /// The target object + /// The new property value public override void SetValue(object entity, object newValue) { var propertyInfo = entity .GetType() .GetProperty(InternalRelationshipName); - + propertyInfo.SetValue(entity, newValue); } } diff --git a/src/JsonApiDotNetCore/Services/QueryComposer.cs b/src/JsonApiDotNetCore/Services/QueryComposer.cs index 8e0819a438..e365811704 100644 --- a/src/JsonApiDotNetCore/Services/QueryComposer.cs +++ b/src/JsonApiDotNetCore/Services/QueryComposer.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using JsonApiDotNetCore.Internal.Query; -using Microsoft.Extensions.Logging; namespace JsonApiDotNetCore.Services { @@ -14,8 +13,8 @@ public class QueryComposer : IQueryComposer public string Compose(IJsonApiContext jsonApiContext) { string result = ""; - if(jsonApiContext != null && jsonApiContext.QuerySet != null) - { + if (jsonApiContext != null && jsonApiContext.QuerySet != null) + { List filterQueries = jsonApiContext.QuerySet.Filters; if (filterQueries.Count > 0) { From ab15d70d10968faf50f28d30f84e842a9dfee0c0 Mon Sep 17 00:00:00 2001 From: Bj Date: Mon, 11 Jun 2018 23:07:19 -0400 Subject: [PATCH 03/14] Make `AddJsonApi` chainable --- .../JsonApiDotNetCoreExample/Startup.cs | 23 ++++++-------- .../IServiceCollectionExtensions.cs | 14 +++++---- .../Helpers/Startups/MetaStartup.cs | 31 +++++++------------ 3 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/Examples/JsonApiDotNetCoreExample/Startup.cs b/src/Examples/JsonApiDotNetCoreExample/Startup.cs index 1388004a55..378a948a61 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Startup.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Startup.cs @@ -29,19 +29,16 @@ public virtual IServiceProvider ConfigureServices(IServiceCollection services) { var loggerFactory = new LoggerFactory(); loggerFactory.AddConsole(LogLevel.Trace); - services.AddSingleton(loggerFactory); - services.AddDbContext(options => - { - options.UseNpgsql(GetDbConnectionString()); - }, ServiceLifetime.Transient); - - services.AddJsonApi(opt => - { - opt.Namespace = "api/v1"; - opt.DefaultPageSize = 5; - opt.IncludeTotalRecordCount = true; - }); + services + .AddSingleton(loggerFactory) + .AddDbContext(options => + options.UseNpgsql(GetDbConnectionString()), ServiceLifetime.Transient) + .AddJsonApi(options => { + options.Namespace = "api/v1"; + options.DefaultPageSize = 5; + options.IncludeTotalRecordCount = true; + }); var provider = services.BuildServiceProvider(); var appContext = provider.GetRequiredService(); @@ -67,4 +64,4 @@ public virtual void Configure( public string GetDbConnectionString() => Config["Data:DefaultConnection"]; } -} \ No newline at end of file +} diff --git a/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs b/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs index 807d21c018..217b5f077b 100644 --- a/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs +++ b/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs @@ -20,21 +20,21 @@ namespace JsonApiDotNetCore.Extensions // ReSharper disable once InconsistentNaming public static class IServiceCollectionExtensions { - public static void AddJsonApi(this IServiceCollection services) + public static IServiceCollection AddJsonApi(this IServiceCollection services) where TContext : DbContext { var mvcBuilder = services.AddMvc(); - AddJsonApi(services, (opt) => { }, mvcBuilder); + return AddJsonApi(services, (opt) => { }, mvcBuilder); } - public static void AddJsonApi(this IServiceCollection services, Action options) + public static IServiceCollection AddJsonApi(this IServiceCollection services, Action options) where TContext : DbContext { var mvcBuilder = services.AddMvc(); - AddJsonApi(services, options, mvcBuilder); + return AddJsonApi(services, options, mvcBuilder); } - public static void AddJsonApi(this IServiceCollection services, + public static IServiceCollection AddJsonApi(this IServiceCollection services, Action options, IMvcBuilder mvcBuilder) where TContext : DbContext { @@ -52,9 +52,10 @@ public static void AddJsonApi(this IServiceCollection services, }); AddJsonApiInternals(services, config); + return services; } - public static void AddJsonApi(this IServiceCollection services, + public static IServiceCollection AddJsonApi(this IServiceCollection services, Action options, IMvcBuilder mvcBuilder) { @@ -70,6 +71,7 @@ public static void AddJsonApi(this IServiceCollection services, }); AddJsonApiInternals(services, config); + return services; } public static void AddJsonApiInternals( diff --git a/test/JsonApiDotNetCoreExampleTests/Helpers/Startups/MetaStartup.cs b/test/JsonApiDotNetCoreExampleTests/Helpers/Startups/MetaStartup.cs index 0001878a50..df32a1223a 100644 --- a/test/JsonApiDotNetCoreExampleTests/Helpers/Startups/MetaStartup.cs +++ b/test/JsonApiDotNetCoreExampleTests/Helpers/Startups/MetaStartup.cs @@ -20,25 +20,18 @@ public MetaStartup(IHostingEnvironment env) public override IServiceProvider ConfigureServices(IServiceCollection services) { var loggerFactory = new LoggerFactory(); - - loggerFactory - .AddConsole(LogLevel.Trace); - - services.AddSingleton(loggerFactory); - - services.AddDbContext(options => - { - options.UseNpgsql(GetDbConnectionString()); - }, ServiceLifetime.Transient); - - services.AddJsonApi(opt => - { - opt.Namespace = "api/v1"; - opt.DefaultPageSize = 5; - opt.IncludeTotalRecordCount = true; - }); - - services.AddScoped(); + loggerFactory.AddConsole(LogLevel.Trace); + + services + .AddSingleton(loggerFactory) + .AddDbContext(options => + options.UseNpgsql(GetDbConnectionString()), ServiceLifetime.Transient) + .AddJsonApi(options => { + options.Namespace = "api/v1"; + options.DefaultPageSize = 5; + options.IncludeTotalRecordCount = true; + }) + .AddScoped(); return services.BuildServiceProvider(); } From 443e0392e4e9d1e62a5c444ee494b83c561b3b19 Mon Sep 17 00:00:00 2001 From: Bj Date: Mon, 11 Jun 2018 23:10:35 -0400 Subject: [PATCH 04/14] Use `MvcCore` instead of `Mvc` --- .travis.yml | 4 ++-- .../Controllers/Restricted/ReadOnlyController.cs | 8 ++++---- .../Controllers/TestValuesController.cs | 2 +- .../Controllers/TodoItemsCustomController.cs | 2 +- src/Examples/NoEntityFrameworkExample/Startup.cs | 4 ++-- src/Examples/ReportsExample/ReportsExample.csproj | 2 +- src/Examples/ReportsExample/Startup.cs | 2 +- .../Controllers/JsonApiControllerMixin.cs | 2 +- .../Controllers/JsonApiOperationsController.cs | 2 +- .../Extensions/IServiceCollectionExtensions.cs | 10 +++++----- src/JsonApiDotNetCore/JsonApiDotNetCore.csproj | 3 ++- 11 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ac38bba9f..9c5e937589 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: csharp dist: trusty sudo: required -services: +services: - postgresql before_script: - psql -c 'create database JsonApiDotNetCoreExample;' -U postgres mono: none -dotnet: 2.1.105 # https://www.microsoft.com/net/download/linux +dotnet: 2.1.300 # https://www.microsoft.com/net/download/linux branches: only: - master diff --git a/src/Examples/JsonApiDotNetCoreExample/Controllers/Restricted/ReadOnlyController.cs b/src/Examples/JsonApiDotNetCoreExample/Controllers/Restricted/ReadOnlyController.cs index 57fafc8fc6..2515b1ea7a 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Controllers/Restricted/ReadOnlyController.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Controllers/Restricted/ReadOnlyController.cs @@ -5,7 +5,7 @@ namespace JsonApiDotNetCoreExample.Controllers.Restricted { [Route("[controller]")] [HttpReadOnly] - public class ReadOnlyController : Controller + public class ReadOnlyController : ControllerBase { [HttpGet] public IActionResult Get() => Ok(); @@ -22,7 +22,7 @@ public class ReadOnlyController : Controller [Route("[controller]")] [NoHttpPost] - public class NoHttpPostController : Controller + public class NoHttpPostController : ControllerBase { [HttpGet] public IActionResult Get() => Ok(); @@ -39,7 +39,7 @@ public class NoHttpPostController : Controller [Route("[controller]")] [NoHttpPatch] - public class NoHttpPatchController : Controller + public class NoHttpPatchController : ControllerBase { [HttpGet] public IActionResult Get() => Ok(); @@ -56,7 +56,7 @@ public class NoHttpPatchController : Controller [Route("[controller]")] [NoHttpDelete] - public class NoHttpDeleteController : Controller + public class NoHttpDeleteController : ControllerBase { [HttpGet] public IActionResult Get() => Ok(); diff --git a/src/Examples/JsonApiDotNetCoreExample/Controllers/TestValuesController.cs b/src/Examples/JsonApiDotNetCoreExample/Controllers/TestValuesController.cs index 3443d34b74..a29295c426 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Controllers/TestValuesController.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Controllers/TestValuesController.cs @@ -3,7 +3,7 @@ namespace JsonApiDotNetCoreExample.Controllers { [Route("[controller]")] - public class TestValuesController : Controller + public class TestValuesController : ControllerBase { [HttpGet] public IActionResult Get() diff --git a/src/Examples/JsonApiDotNetCoreExample/Controllers/TodoItemsCustomController.cs b/src/Examples/JsonApiDotNetCoreExample/Controllers/TodoItemsCustomController.cs index de784c129a..fc25f8396e 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Controllers/TodoItemsCustomController.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Controllers/TodoItemsCustomController.cs @@ -33,7 +33,7 @@ public CustomJsonApiController( } public class CustomJsonApiController - : Controller where T : class, IIdentifiable + : ControllerBase where T : class, IIdentifiable { private readonly ILogger _logger; private readonly IResourceService _resourceService; diff --git a/src/Examples/NoEntityFrameworkExample/Startup.cs b/src/Examples/NoEntityFrameworkExample/Startup.cs index dfba27ddd9..86eee500c9 100755 --- a/src/Examples/NoEntityFrameworkExample/Startup.cs +++ b/src/Examples/NoEntityFrameworkExample/Startup.cs @@ -1,4 +1,4 @@ -using JsonApiDotNetCore.Extensions; +using JsonApiDotNetCore.Extensions; using JsonApiDotNetCore.Services; using JsonApiDotNetCoreExample.Data; using JsonApiDotNetCoreExample.Models; @@ -31,7 +31,7 @@ public Startup(IHostingEnvironment env) public virtual IServiceProvider ConfigureServices(IServiceCollection services) { // Add framework services. - var mvcBuilder = services.AddMvc(); + var mvcBuilder = services.AddMvcCore(); services.AddJsonApi(options => { options.Namespace = "api/v1"; diff --git a/src/Examples/ReportsExample/ReportsExample.csproj b/src/Examples/ReportsExample/ReportsExample.csproj index bd4b402071..48df3ea2c8 100644 --- a/src/Examples/ReportsExample/ReportsExample.csproj +++ b/src/Examples/ReportsExample/ReportsExample.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/Examples/ReportsExample/Startup.cs b/src/Examples/ReportsExample/Startup.cs index 72710681b9..fe476c0406 100644 --- a/src/Examples/ReportsExample/Startup.cs +++ b/src/Examples/ReportsExample/Startup.cs @@ -25,7 +25,7 @@ public Startup(IHostingEnvironment env) public virtual void ConfigureServices(IServiceCollection services) { - var mvcBuilder = services.AddMvc(); + var mvcBuilder = services.AddMvcCore(); services.AddJsonApi(opt => { opt.BuildContextGraph(builder => diff --git a/src/JsonApiDotNetCore/Controllers/JsonApiControllerMixin.cs b/src/JsonApiDotNetCore/Controllers/JsonApiControllerMixin.cs index 6fff3a22c8..840422eb6c 100644 --- a/src/JsonApiDotNetCore/Controllers/JsonApiControllerMixin.cs +++ b/src/JsonApiDotNetCore/Controllers/JsonApiControllerMixin.cs @@ -5,7 +5,7 @@ namespace JsonApiDotNetCore.Controllers { - public abstract class JsonApiControllerMixin : Controller + public abstract class JsonApiControllerMixin : ControllerBase { protected IActionResult UnprocessableEntity() { diff --git a/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs b/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs index c3b667bc7d..f6db9f0d06 100644 --- a/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs +++ b/src/JsonApiDotNetCore/Controllers/JsonApiOperationsController.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCore.Controllers /// /// A controller to be used for bulk operations as defined in the json:api 1.1 specification /// - public class JsonApiOperationsController : Controller + public class JsonApiOperationsController : ControllerBase { private readonly IOperationsProcessor _operationsProcessor; diff --git a/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs b/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs index 217b5f077b..5e8eeefdd1 100644 --- a/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs +++ b/src/JsonApiDotNetCore/Extensions/IServiceCollectionExtensions.cs @@ -23,20 +23,20 @@ public static class IServiceCollectionExtensions public static IServiceCollection AddJsonApi(this IServiceCollection services) where TContext : DbContext { - var mvcBuilder = services.AddMvc(); - return AddJsonApi(services, (opt) => { }, mvcBuilder); + var mvcBuilder = services.AddMvcCore(); + return AddJsonApi(services, opt => { }, mvcBuilder); } public static IServiceCollection AddJsonApi(this IServiceCollection services, Action options) where TContext : DbContext { - var mvcBuilder = services.AddMvc(); + var mvcBuilder = services.AddMvcCore(); return AddJsonApi(services, options, mvcBuilder); } public static IServiceCollection AddJsonApi(this IServiceCollection services, Action options, - IMvcBuilder mvcBuilder) where TContext : DbContext + IMvcCoreBuilder mvcBuilder) where TContext : DbContext { var config = new JsonApiOptions(); @@ -57,7 +57,7 @@ public static IServiceCollection AddJsonApi(this IServiceCollection se public static IServiceCollection AddJsonApi(this IServiceCollection services, Action options, - IMvcBuilder mvcBuilder) + IMvcCoreBuilder mvcBuilder) { var config = new JsonApiOptions(); diff --git a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj index 4f52a23002..960f0f84ea 100755 --- a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj +++ b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj @@ -19,11 +19,12 @@ - + + - 15.3.0-preview-20170427-09 - 1.1.2 - 2.3.0-beta3-build3705 - 15.0.3 - 4.7.99 + 15.7.2 + 2.3.1 + 22.1.2 + 4.8.3 diff --git a/benchmarks/Benchmarks.csproj b/benchmarks/Benchmarks.csproj index 1e8b227f3c..21de8e1aa2 100644 --- a/benchmarks/Benchmarks.csproj +++ b/benchmarks/Benchmarks.csproj @@ -5,7 +5,7 @@ Benchmarks - + diff --git a/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.Designer.cs b/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.Designer.cs index c86425b00c..c9788bf82f 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.Designer.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.Designer.cs @@ -1,4 +1,4 @@ -// +// using JsonApiDotNetCoreExample.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Internal; using System; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace JsonApiDotNetCoreExample.Migrations { diff --git a/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.cs b/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.cs index ba19b62ef6..cc696f54bf 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Migrations/20180327120810_initial.cs @@ -1,7 +1,8 @@ -using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using System; using System.Collections.Generic; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace JsonApiDotNetCoreExample.Migrations { diff --git a/src/Examples/JsonApiDotNetCoreExample/Migrations/AppDbContextModelSnapshot.cs b/src/Examples/JsonApiDotNetCoreExample/Migrations/AppDbContextModelSnapshot.cs index c0794103fe..08c284393e 100755 --- a/src/Examples/JsonApiDotNetCoreExample/Migrations/AppDbContextModelSnapshot.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Migrations/AppDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -// +// using JsonApiDotNetCoreExample.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Internal; using System; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace JsonApiDotNetCoreExample.Migrations { diff --git a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj index eed5f1b09e..efdaa68e5b 100755 --- a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj +++ b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/Examples/ReportsExample/ReportsExample.csproj b/src/Examples/ReportsExample/ReportsExample.csproj index 48df3ea2c8..24c01b9a8d 100644 --- a/src/Examples/ReportsExample/ReportsExample.csproj +++ b/src/Examples/ReportsExample/ReportsExample.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj index 960f0f84ea..b8af04e278 100755 --- a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj +++ b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj @@ -17,14 +17,14 @@ - + - - + +