Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions benchmarks/Deserialization/DeserializationBenchmarkBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public abstract class DeserializationBenchmarkBase : IDisposable
protected DeserializationBenchmarkBase()
{
var options = new JsonApiOptions();
IResourceGraph resourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<IncomingResource, int>().Build();
IResourceGraph resourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<IncomingResource, long>().Build();
options.SerializerOptions.Converters.Add(new ResourceObjectConverter(resourceGraph));
SerializerReadOptions = ((IJsonApiOptions)options).SerializerReadOptions;

var resourceFactory = new ResourceFactory(_serviceProvider);
var resourceDefinitionAccessor = new ResourceDefinitionAccessor(resourceGraph, _serviceProvider);

_serviceProvider.AddService(typeof(IResourceDefinitionAccessor), resourceDefinitionAccessor);
_serviceProvider.AddService(typeof(IResourceDefinition<IncomingResource, int>), new JsonApiResourceDefinition<IncomingResource, int>(resourceGraph));
_serviceProvider.AddService(typeof(IResourceDefinition<IncomingResource, long>), new JsonApiResourceDefinition<IncomingResource, long>(resourceGraph));

// ReSharper disable once VirtualMemberCallInConstructor
JsonApiRequest request = CreateJsonApiRequest(resourceGraph);
Expand Down Expand Up @@ -71,7 +71,7 @@ private void Dispose(bool disposing)
}

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public sealed class IncomingResource : Identifiable<int>
public sealed class IncomingResource : Identifiable<long>
{
[Attr]
public bool Attribute01 { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/QueryString/QueryStringParserBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public QueryStringParserBenchmarks()
EnableLegacyFilterNotation = true
};

IResourceGraph resourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<QueryableResource, int>("alt-resource-name").Build();
IResourceGraph resourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<QueryableResource, long>("alt-resource-name").Build();

var request = new JsonApiRequest
{
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/QueryString/QueryableResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Benchmarks.QueryString;

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public sealed class QueryableResource : Identifiable<int>
public sealed class QueryableResource : Identifiable<long>
{
[Attr(PublicName = "alt-attr-name")]
public string? Name { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/Serialization/SerializationBenchmarkBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected SerializationBenchmarkBase()
}
};

ResourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<OutgoingResource, int>().Build();
ResourceGraph = new ResourceGraphBuilder(options, NullLoggerFactory.Instance).Add<OutgoingResource, long>().Build();
SerializerWriteOptions = ((IJsonApiOptions)options).SerializerWriteOptions;

// ReSharper disable VirtualMemberCallInConstructor
Expand All @@ -55,7 +55,7 @@ protected SerializationBenchmarkBase()
protected abstract IEvaluatedIncludeCache CreateEvaluatedIncludeCache(IResourceGraph resourceGraph);

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
public sealed class OutgoingResource : Identifiable<int>
public sealed class OutgoingResource : Identifiable<long>
{
[Attr]
public bool Attribute01 { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/extensibility/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Then on your model, pass in the set of endpoints to expose (the ones that you've
```c#
[Resource(GenerateControllerEndpoints =
JsonApiEndpoints.Create | JsonApiEndpoints.Delete)]
public class Article : Identifiable<int>
public class Article : identifiable<long>
{
// ...
}
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ options.ValidateModelState = true;
```c#
#nullable enable

public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Attr]
[MinLength(3)]
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/resource-graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ builder.Services.AddJsonApi(resources: resourceGraphBuilder =>
2. The `PublicName` property when a model is decorated with a `ResourceAttribute`.
```c#
[Resource(PublicName = "individuals")]
public class Person : Identifiable<int>
public class Person : identifiable<long>
{
}
```

3. The configured naming convention (by default this is camel-case), after pluralization.
```c#
// this will be registered as "people"
public class Person : Identifiable<int>
public class Person : identifiable<long>
{
}
```
Expand Down
18 changes: 9 additions & 9 deletions docs/usage/resources/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ If you want an attribute on your model to be publicly available, add the `AttrAt
```c#
#nullable enable

public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Attr]
public string? FirstName { get; set; }
Expand All @@ -24,7 +24,7 @@ There are two ways the exposed attribute name is determined:
2. Individually using the attribute's constructor.
```c#
#nullable enable
public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Attr(PublicName = "first-name")]
public string? FirstName { get; set; }
Expand All @@ -51,7 +51,7 @@ Otherwise, the attribute is silently omitted.
```c#
#nullable enable

public class User : Identifiable<int>
public class User : identifiable<long>
{
[Attr(Capabilities = ~AttrCapabilities.AllowView)]
public string Password { get; set; } = null!;
Expand All @@ -65,7 +65,7 @@ Indicates whether the attribute can be filtered on. When not allowed and used in
```c#
#nullable enable

public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Attr(Capabilities = AttrCapabilities.AllowFilter)]
public string? FirstName { get; set; }
Expand All @@ -79,7 +79,7 @@ Indicates whether the attribute can be sorted on. When not allowed and used in `
```c#
#nullable enable

public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Attr(Capabilities = ~AttrCapabilities.AllowSort)]
public string? FirstName { get; set; }
Expand All @@ -93,7 +93,7 @@ Indicates whether POST requests can assign the attribute value. When sent but no
```c#
#nullable enable

public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Attr(Capabilities = AttrCapabilities.AllowCreate)]
public string? CreatorName { get; set; }
Expand All @@ -107,7 +107,7 @@ Indicates whether PATCH requests can update the attribute value. When sent but n
```c#
#nullable enable

public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Attr(Capabilities = AttrCapabilities.AllowChange)]
public string? FirstName { get; set; };
Expand All @@ -124,7 +124,7 @@ You can also use [global options](~/usage/options.md#customize-serializer-option
```c#
#nullable enable

public class Foo : Identifiable<int>
public class Foo : identifiable<long>
{
[Attr]
public Bar? Bar { get; set; }
Expand All @@ -146,7 +146,7 @@ and retrieval.
```c#
#nullable enable

public class Foo : Identifiable<int>
public class Foo : identifiable<long>
{
[Attr]
[NotMapped]
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/resources/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Person : Identifiable<Guid>
If you need to attach annotations or attributes on the `Id` property, you can override the virtual property.

```c#
public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[Key]
[Column("PersonID")]
Expand Down
6 changes: 3 additions & 3 deletions docs/usage/resources/nullability.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To make JsonApiDotNetCore return an error when such a property is missing on res
Example:

```c#
public sealed class User : Identifiable<int>
public sealed class User : identifiable<long>
{
[Attr]
[Required]
Expand All @@ -35,7 +35,7 @@ Example:
```c#
#nullable disable

public sealed class Label : Identifiable<int>
public sealed class Label : identifiable<long>
{
[Attr]
[Required]
Expand Down Expand Up @@ -69,7 +69,7 @@ Example:
```c#
#nullable enable

public sealed class Label : Identifiable<int>
public sealed class Label : identifiable<long>
{
[Attr]
public string Name { get; set; } = null!;
Expand Down
32 changes: 16 additions & 16 deletions docs/usage/resources/relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This exposes a to-one relationship.
```c#
#nullable enable

public class TodoItem : Identifiable<int>
public class TodoItem : identifiable<long>
{
[HasOne]
public Person? Owner { get; set; }
Expand All @@ -36,13 +36,13 @@ The next example defines that each car requires an engine, while an engine is op
```c#
#nullable enable

public sealed class Car : Identifiable<int>
public sealed class Car : identifiable<long>
{
[HasOne]
public Engine Engine { get; set; } = null!;
}

public sealed class Engine : Identifiable<int>
public sealed class Engine : identifiable<long>
{
[HasOne]
public Car? Car { get; set; }
Expand Down Expand Up @@ -123,13 +123,13 @@ The next example defines that each car optionally has an engine, while an engine
```c#
#nullable enable

public sealed class Car : Identifiable<int>
public sealed class Car : identifiable<long>
{
[HasOne]
public Engine? Engine { get; set; }
}

public sealed class Engine : Identifiable<int>
public sealed class Engine : identifiable<long>
{
[HasOne]
public Car? Car { get; set; }
Expand Down Expand Up @@ -204,7 +204,7 @@ CREATE UNIQUE INDEX "IX_Cars_EngineId" ON "Cars" ("EngineId");
This exposes a to-many relationship.

```c#
public class Person : Identifiable<int>
public class Person : identifiable<long>
{
[HasMany]
public ICollection<TodoItem> TodoItems { get; set; } = new HashSet<TodoItem>();
Expand Down Expand Up @@ -236,7 +236,7 @@ However, under the covers it would use the join type and Entity Framework Core's
```c#
#nullable disable

public class Article : Identifiable<int>
public class Article : identifiable<long>
{
// tells Entity Framework Core to ignore this property
[NotMapped]
Expand All @@ -261,7 +261,7 @@ There are two ways the exposed relationship name is determined:
2. Individually using the attribute's constructor.
```c#
#nullable enable
public class TodoItem : Identifiable<int>
public class TodoItem : identifiable<long>
{
[HasOne(PublicName = "item-owner")]
public Person Owner { get; set; } = null!;
Expand Down Expand Up @@ -294,7 +294,7 @@ Otherwise, the relationship (and its related resources, when included) are silen
```c#
#nullable enable

public class User : Identifiable<int>
public class User : identifiable<long>
{
[HasOne(Capabilities = ~HasOneCapabilities.AllowView)]
public LoginAccount Account { get; set; } = null!;
Expand All @@ -308,7 +308,7 @@ Indicates whether the relationship can be included. When not allowed and used in
```c#
#nullable enable

public class User : Identifiable<int>
public class User : identifiable<long>
{
[HasMany(Capabilities = ~HasManyCapabilities.AllowInclude)]
public ISet<Group> Groups { get; set; } = new HashSet<Group>();
Expand All @@ -322,7 +322,7 @@ For to-many relationships only. Indicates whether it can be used in the `count()
```c#
#nullable enable

public class User : Identifiable<int>
public class User : identifiable<long>
{
[HasMany(Capabilities = HasManyCapabilities.AllowFilter)]
public ISet<Group> Groups { get; set; } = new HashSet<Group>();
Expand All @@ -336,7 +336,7 @@ Indicates whether POST and PATCH requests can replace the relationship. When sen
```c#
#nullable enable

public class User : Identifiable<int>
public class User : identifiable<long>
{
[HasOne(Capabilities = ~HasOneCapabilities.AllowSet)]
public LoginAccount Account { get; set; } = null!;
Expand All @@ -350,7 +350,7 @@ For to-many relationships only. Indicates whether POST requests can add resource
```c#
#nullable enable

public class User : Identifiable<int>
public class User : identifiable<long>
{
[HasMany(Capabilities = ~HasManyCapabilities.AllowAdd)]
public ISet<Group> Groups { get; set; } = new HashSet<Group>();
Expand All @@ -364,7 +364,7 @@ For to-many relationships only. Indicates whether DELETE requests can remove res
```c#
#nullable enable

public class User : Identifiable<int>
public class User : identifiable<long>
{
[HasMany(Capabilities = ~HasManyCapabilities.AllowRemove)]
public ISet<Group> Groups { get; set; } = new HashSet<Group>();
Expand All @@ -380,7 +380,7 @@ Relationships can be marked to disallow including them using the `?include=` que
```c#
#nullable enable

public class TodoItem : Identifiable<int>
public class TodoItem : identifiable<long>
{
[HasOne(CanInclude: false)]
public Person? Owner { get; set; }
Expand All @@ -397,7 +397,7 @@ So for the calculated property to be evaluated correctly, the related entity mus
```c#
#nullable enable

public class ShippingAddress : Identifiable<int>
public class ShippingAddress : identifiable<long>
{
[Attr]
public string Street { get; set; } = null!;
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The library will configure routes for all auto-generated and hand-written contro
```c#
// Auto-generated
[Resource]
public class OrderSummary : Identifiable<int>
public class OrderSummary : identifiable<long>
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Examples/GettingStarted/Models/Book.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace GettingStarted.Models;

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
[Resource]
public sealed class Book : Identifiable<int>
public sealed class Book : Identifiable<long>
{
[Attr]
public string Title { get; set; } = null!;
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/GettingStarted/Models/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace GettingStarted.Models;

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
[Resource]
public sealed class Person : Identifiable<int>
public sealed class Person : Identifiable<long>
{
[Attr]
public string Name { get; set; } = null!;
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/MultiDbContextExample/Models/ResourceA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace MultiDbContextExample.Models;

[UsedImplicitly(ImplicitUseTargetFlags.Members)]
[Resource]
public sealed class ResourceA : Identifiable<int>
public sealed class ResourceA : Identifiable<long>
{
[Attr]
public string? NameA { get; set; }
Expand Down
Loading
Loading