Skip to content

Commit 77d88d8

Browse files
committed
Auto-generated documentation from 3cd643a
1 parent 6afb1a9 commit 77d88d8

14 files changed

Lines changed: 495 additions & 495 deletions

sitemap.xml

Lines changed: 429 additions & 429 deletions
Large diffs are not rendered by default.

usage/errors.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ <h1 id="exception-handling">Exception handling</h1>
113113
This handler is also the place to choose the log level and message, based on the exception type.</p>
114114
<pre><code class="lang-c#">public class ProductOutOfStockException : Exception
115115
{
116-
public int ProductId { get; }
116+
public long ProductId { get; }
117117

118-
public ProductOutOfStockException(int productId)
118+
public ProductOutOfStockException(long productId)
119119
{
120120
ProductId = productId;
121121
}

usage/extensibility/controllers.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ <h3 id="resource-access-control-1">Resource Access Control</h3>
183183
Likewise, to provide write-only access, inherit from <code>JsonApiCommandController</code>, which blocks all GET and HEAD requests.</p>
184184
<p>You can even make your own mix of allowed routes by calling the alternate constructor of <code>JsonApiController</code> and injecting the set of service implementations available.
185185
In some cases, resources may be an aggregation of entities or a view on top of the underlying entities. In these cases, there may not be a writable <code>IResourceService</code> implementation, so simply inject the implementation that is available.</p>
186-
<pre><code class="lang-c#">public class ReportsController : JsonApiController&lt;Report, int&gt;
186+
<pre><code class="lang-c#">public class ReportsController : JsonApiController&lt;Report, long&gt;
187187
{
188188
public ReportsController(IJsonApiOptions options, IResourceGraph resourceGraph,
189-
ILoggerFactory loggerFactory, IGetAllService&lt;Report, int&gt; getAllService)
189+
ILoggerFactory loggerFactory, IGetAllService&lt;Report, long&gt; getAllService)
190190
: base(options, resourceGraph, loggerFactory, getAll: getAllService)
191191
{
192192
}

usage/extensibility/repositories.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ <h1 id="resource-repositories">Resource Repositories</h1>
9393
<p>If you want to use a data access technology other than Entity Framework Core, you can create an implementation of <code>IResourceRepository&lt;TResource, TId&gt;</code>.
9494
If you only need minor changes you can override the methods defined in <code>EntityFrameworkCoreRepository&lt;TResource, TId&gt;</code>.</p>
9595
<pre><code class="lang-c#">// Program.cs
96-
builder.Services.AddScoped&lt;IResourceRepository&lt;Article, int&gt;, ArticleRepository&gt;();
97-
builder.Services.AddScoped&lt;IResourceReadRepository&lt;Article, int&gt;, ArticleRepository&gt;();
98-
builder.Services.AddScoped&lt;IResourceWriteRepository&lt;Article, int&gt;, ArticleRepository&gt;();
96+
builder.Services.AddScoped&lt;IResourceRepository&lt;Article, long&gt;, ArticleRepository&gt;();
97+
builder.Services.AddScoped&lt;IResourceReadRepository&lt;Article, long&gt;, ArticleRepository&gt;();
98+
builder.Services.AddScoped&lt;IResourceWriteRepository&lt;Article, long&gt;, ArticleRepository&gt;();
9999
</code></pre>
100100
<p>In v4.0 we introduced an extension method that you can use to register a resource repository on all of its JsonApiDotNetCore interfaces.
101101
This is helpful when you implement (a subset of) the resource interfaces and want to register them all in one go.</p>
@@ -108,7 +108,7 @@ <h5>Tip</h5>
108108
</div>
109109
<p>A sample implementation that performs authorization might look like this.</p>
110110
<p>All of the methods in EntityFrameworkCoreRepository will use the <code>GetAll()</code> method to get the <code>DbSet&lt;TResource&gt;</code>, so this is a good method to apply filters such as user or tenant authorization.</p>
111-
<pre><code class="lang-c#">public class ArticleRepository : EntityFrameworkCoreRepository&lt;Article, int&gt;
111+
<pre><code class="lang-c#">public class ArticleRepository : EntityFrameworkCoreRepository&lt;Article, long&gt;
112112
{
113113
private readonly IAuthenticationService _authenticationService;
114114

usage/extensibility/resource-definitions.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ <h5>Tip</h5>
104104
<div class="NOTE">
105105
<h5>Note</h5>
106106
<p>Prior to the introduction of auto-discovery (in v3), you needed to register the resource definition on the container yourself:</p>
107-
<pre><code class="lang-c#">builder.Services.AddScoped&lt;ResourceDefinition&lt;Article, int&gt;, ArticleDefinition&gt;();
107+
<pre><code class="lang-c#">builder.Services.AddScoped&lt;ResourceDefinition&lt;Article, long&gt;, ArticleDefinition&gt;();
108108
</code></pre>
109109
</div>
110110
<h2 id="customizing-queries">Customizing queries</h2>
@@ -121,7 +121,7 @@ <h3 id="excluding-fields">Excluding fields</h3>
121121
<h5>Note</h5>
122122
<p>To exclude fields unconditionally, <a href="../resources/attributes.html#capabilities">attribute capabilities</a> and <a href="../resources/relationships.html#capabilities">relationship capabilities</a> can be used instead.</p>
123123
</div>
124-
<pre><code class="lang-c#">public class UserDefinition : JsonApiResourceDefinition&lt;User, int&gt;
124+
<pre><code class="lang-c#">public class UserDefinition : JsonApiResourceDefinition&lt;User, long&gt;
125125
{
126126
public UserDefinition(IResourceGraph resourceGraph)
127127
: base(resourceGraph)
@@ -171,7 +171,7 @@ <h5>Note</h5>
171171
</code></pre>
172172
<h3 id="default-sort-order">Default sort order</h3>
173173
<p>You can define the default sort order if no <code>sort</code> query string parameter is provided.</p>
174-
<pre><code class="lang-c#">public class AccountDefinition : JsonApiResourceDefinition&lt;Account, int&gt;
174+
<pre><code class="lang-c#">public class AccountDefinition : JsonApiResourceDefinition&lt;Account, long&gt;
175175
{
176176
public AccountDefinition(IResourceGraph resourceGraph)
177177
: base(resourceGraph)
@@ -195,7 +195,7 @@ <h3 id="default-sort-order">Default sort order</h3>
195195
</code></pre>
196196
<h3 id="enforce-page-size">Enforce page size</h3>
197197
<p>You may want to enforce pagination on large database tables.</p>
198-
<pre><code class="lang-c#">public class AccessLogDefinition : JsonApiResourceDefinition&lt;AccessLog, int&gt;
198+
<pre><code class="lang-c#">public class AccessLogDefinition : JsonApiResourceDefinition&lt;AccessLog, long&gt;
199199
{
200200
public AccessLogDefinition(IResourceGraph resourceGraph)
201201
: base(resourceGraph)
@@ -222,7 +222,7 @@ <h3 id="enforce-page-size">Enforce page size</h3>
222222
</code></pre>
223223
<h3 id="change-filters">Change filters</h3>
224224
<p>The next example filters out <code>Account</code> resources that are suspended.</p>
225-
<pre><code class="lang-c#">public class AccountDefinition : JsonApiResourceDefinition&lt;Account, int&gt;
225+
<pre><code class="lang-c#">public class AccountDefinition : JsonApiResourceDefinition&lt;Account, long&gt;
226226
{
227227
public AccountDefinition(IResourceGraph resourceGraph)
228228
: base(resourceGraph)
@@ -247,7 +247,7 @@ <h3 id="change-filters">Change filters</h3>
247247
</code></pre>
248248
<h3 id="block-including-related-resources">Block including related resources</h3>
249249
<p>In the example below, an error is returned when a user tries to include the manager of an employee.</p>
250-
<pre><code class="lang-c#">public class EmployeeDefinition : JsonApiResourceDefinition&lt;Employee, int&gt;
250+
<pre><code class="lang-c#">public class EmployeeDefinition : JsonApiResourceDefinition&lt;Employee, long&gt;
251251
{
252252
public EmployeeDefinition(IResourceGraph resourceGraph)
253253
: base(resourceGraph)
@@ -279,7 +279,7 @@ <h5>Note</h5>
279279
<p>This directly influences the Entity Framework Core <code>IQueryable</code>. As opposed to using <code>OnApplyFilter</code>, this enables the full range of Entity Framework Core operators.
280280
But it only works on primary resource endpoints (for example: /articles, but not on /blogs/1/articles or /blogs?include=articles).</p>
281281
</div>
282-
<pre><code class="lang-c#">public class ItemDefinition : JsonApiResourceDefinition&lt;Item, int&gt;
282+
<pre><code class="lang-c#">public class ItemDefinition : JsonApiResourceDefinition&lt;Item, long&gt;
283283
{
284284
public ItemDefinition(IResourceGraph resourceGraph)
285285
: base(resourceGraph)

usage/extensibility/services.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ <h2 id="supplementing-default-behavior">Supplementing Default Behavior</h2>
9797
<p>If you don't need to alter the underlying mechanisms, you can inherit from <code>JsonApiResourceService&lt;TResource, TId&gt;</code> and override the existing methods.
9898
In simple cases, you can also just wrap the base implementation with your custom logic.</p>
9999
<p>A simple example would be to send notifications when a resource gets created.</p>
100-
<pre><code class="lang-c#">public class TodoItemService : JsonApiResourceService&lt;TodoItem, int&gt;
100+
<pre><code class="lang-c#">public class TodoItemService : JsonApiResourceService&lt;TodoItem, long&gt;
101101
{
102102
private readonly INotificationService _notificationService;
103103

@@ -132,14 +132,14 @@ <h2 id="not-using-entity-framework-core">Not Using Entity Framework Core?</h2>
132132
<pre><code class="lang-c#">// Program.cs
133133

134134
// Add the service override for Product.
135-
builder.Services.AddScoped&lt;IResourceService&lt;Product, int&gt;, ProductService&gt;();
135+
builder.Services.AddScoped&lt;IResourceService&lt;Product, long&gt;, ProductService&gt;();
136136

137137
// Add your own Data Access Object.
138138
builder.Services.AddScoped&lt;IProductDao, ProductDao&gt;();
139139

140140
// ProductService.cs
141141

142-
public class ProductService : IResourceService&lt;Product, int&gt;
142+
public class ProductService : IResourceService&lt;Product, long&gt;
143143
{
144144
private readonly IProductDao _dao;
145145

@@ -187,14 +187,14 @@ <h2 id="limited-requirements">Limited Requirements</h2>
187187
IResourceCommandService &lt;|-- IRemoveFromRelationshipService
188188
</code></pre>
189189
<p>In order to take advantage of these interfaces you first need to register the service for each implemented interface.</p>
190-
<pre><code class="lang-c#">public class ArticleService : ICreateService&lt;Article, int&gt;, IDeleteService&lt;Article, int&gt;
190+
<pre><code class="lang-c#">public class ArticleService : ICreateService&lt;Article, long&gt;, IDeleteService&lt;Article, long&gt;
191191
{
192192
// ...
193193
}
194194

195195
// Program.cs
196-
builder.Services.AddScoped&lt;ICreateService&lt;Article, int&gt;, ArticleService&gt;();
197-
builder.Services.AddScoped&lt;IDeleteService&lt;Article, int&gt;, ArticleService&gt;();
196+
builder.Services.AddScoped&lt;ICreateService&lt;Article, long&gt;, ArticleService&gt;();
197+
builder.Services.AddScoped&lt;IDeleteService&lt;Article, long&gt;, ArticleService&gt;();
198198
</code></pre>
199199
<p>In v3.0 we introduced an extension method that you can use to register a resource service on all of its JsonApiDotNetCore interfaces.
200200
This is helpful when you implement (a subset of) the resource interfaces and want to register them all in one go.</p>
@@ -208,17 +208,17 @@ <h5>Tip</h5>
208208
<p>Then on your model, pass in the set of endpoints to expose (the ones that you've registered services for):</p>
209209
<pre><code class="lang-c#">[Resource(GenerateControllerEndpoints =
210210
JsonApiEndpoints.Create | JsonApiEndpoints.Delete)]
211-
public class Article : Identifiable&lt;int&gt;
211+
public class Article : Identifiable&lt;long&gt;
212212
{
213213
// ...
214214
}
215215
</code></pre>
216216
<p>Alternatively, when using a hand-written controller, you should inherit from the JSON:API controller and pass the services into the named, optional base parameters:</p>
217-
<pre><code class="lang-c#">public class ArticlesController : JsonApiController&lt;Article, int&gt;
217+
<pre><code class="lang-c#">public class ArticlesController : JsonApiController&lt;Article, long&gt;
218218
{
219219
public ArticlesController(IJsonApiOptions options, IResourceGraph resourceGraph,
220-
ILoggerFactory loggerFactory, ICreateService&lt;Article, int&gt; create,
221-
IDeleteService&lt;Article, int&gt; delete)
220+
ILoggerFactory loggerFactory, ICreateService&lt;Article, long&gt; create,
221+
IDeleteService&lt;Article, long&gt; delete)
222222
: base(options, resourceGraph, loggerFactory, create: create, delete: delete)
223223
{
224224
}

usage/meta.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ <h2 id="resource-meta">Resource Meta</h2>
127127
<p>Resource-specific metadata can be added by implementing <code>IResourceDefinition&lt;TResource, TId&gt;.GetMeta</code> (or overriding it on <code>JsonApiResourceDefinition&lt;TResource, TId&gt;</code>):</p>
128128
<pre><code class="lang-c#">#nullable enable
129129

130-
public class PersonDefinition : JsonApiResourceDefinition&lt;Person, int&gt;
130+
public class PersonDefinition : JsonApiResourceDefinition&lt;Person, long&gt;
131131
{
132132
public PersonDefinition(IResourceGraph resourceGraph)
133133
: base(resourceGraph)

usage/options.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ <h2 id="modelstate-validation">ModelState Validation</h2>
181181
</code></pre>
182182
<pre><code class="lang-c#">#nullable enable
183183

184-
public class Person : Identifiable&lt;int&gt;
184+
public class Person : Identifiable&lt;long&gt;
185185
{
186186
[Attr]
187187
[MinLength(3)]

usage/resource-graph.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ <h3 id="manual-specification">Manual Specification</h3>
127127
<p>You can manually construct the graph.</p>
128128
<pre><code class="lang-c#">// Program.cs
129129
builder.Services.AddJsonApi(resources: resourceGraphBuilder =&gt;
130-
resourceGraphBuilder.Add&lt;Person, int&gt;());
130+
resourceGraphBuilder.Add&lt;Person, long&gt;());
131131
</code></pre>
132132
<h2 id="resource-name">Resource Name</h2>
133133
<p>The public resource name is exposed through the <code>type</code> member in the JSON:API payload. This can be configured using the following approaches (in order of priority):</p>
@@ -137,22 +137,22 @@ <h2 id="resource-name">Resource Name</h2>
137137
<pre><code class="lang-c#">// Program.cs
138138
builder.Services.AddJsonApi(resources: resourceGraphBuilder =&gt;
139139
{
140-
resourceGraphBuilder.Add&lt;Person, int&gt;(publicName: &quot;individuals&quot;);
140+
resourceGraphBuilder.Add&lt;Person, long&gt;(publicName: &quot;individuals&quot;);
141141
});
142142
</code></pre>
143143
<ol start="2">
144144
<li>The <code>PublicName</code> property when a model is decorated with a <code>ResourceAttribute</code>.</li>
145145
</ol>
146146
<pre><code class="lang-c#">[Resource(PublicName = &quot;individuals&quot;)]
147-
public class Person : Identifiable&lt;int&gt;
147+
public class Person : Identifiable&lt;long&gt;
148148
{
149149
}
150150
</code></pre>
151151
<ol start="3">
152152
<li>The configured naming convention (by default this is camel-case), after pluralization.</li>
153153
</ol>
154154
<pre><code class="lang-c#">// this will be registered as &quot;people&quot;
155-
public class Person : Identifiable&lt;int&gt;
155+
public class Person : Identifiable&lt;long&gt;
156156
{
157157
}
158158
</code></pre>

usage/resources/attributes.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ <h1 id="attributes">Attributes</h1>
9393
<p>If you want an attribute on your model to be publicly available, add the <code>AttrAttribute</code>.</p>
9494
<pre><code class="lang-c#">#nullable enable
9595

96-
public class Person : Identifiable&lt;int&gt;
96+
public class Person : Identifiable&lt;long&gt;
9797
{
9898
[Attr]
9999
public string? FirstName { get; set; }
@@ -111,7 +111,7 @@ <h2 id="name">Name</h2>
111111
</li>
112112
</ol>
113113
<pre><code class="lang-c#">#nullable enable
114-
public class Person : Identifiable&lt;int&gt;
114+
public class Person : Identifiable&lt;long&gt;
115115
{
116116
[Attr(PublicName = &quot;first-name&quot;)]
117117
public string? FirstName { get; set; }
@@ -128,7 +128,7 @@ <h3 id="allowview">AllowView</h3>
128128
Otherwise, the attribute is silently omitted.</p>
129129
<pre><code class="lang-c#">#nullable enable
130130

131-
public class User : Identifiable&lt;int&gt;
131+
public class User : Identifiable&lt;long&gt;
132132
{
133133
[Attr(Capabilities = ~AttrCapabilities.AllowView)]
134134
public string Password { get; set; } = null!;
@@ -138,7 +138,7 @@ <h3 id="allowfilter">AllowFilter</h3>
138138
<p>Indicates whether the attribute can be filtered on. When not allowed and used in <code>?filter=</code>, an HTTP 400 is returned.</p>
139139
<pre><code class="lang-c#">#nullable enable
140140

141-
public class Person : Identifiable&lt;int&gt;
141+
public class Person : Identifiable&lt;long&gt;
142142
{
143143
[Attr(Capabilities = AttrCapabilities.AllowFilter)]
144144
public string? FirstName { get; set; }
@@ -148,7 +148,7 @@ <h3 id="allowsort">AllowSort</h3>
148148
<p>Indicates whether the attribute can be sorted on. When not allowed and used in <code>?sort=</code>, an HTTP 400 is returned.</p>
149149
<pre><code class="lang-c#">#nullable enable
150150

151-
public class Person : Identifiable&lt;int&gt;
151+
public class Person : Identifiable&lt;long&gt;
152152
{
153153
[Attr(Capabilities = ~AttrCapabilities.AllowSort)]
154154
public string? FirstName { get; set; }
@@ -158,7 +158,7 @@ <h3 id="allowcreate">AllowCreate</h3>
158158
<p>Indicates whether POST requests can assign the attribute value. When sent but not allowed, an HTTP 422 response is returned.</p>
159159
<pre><code class="lang-c#">#nullable enable
160160

161-
public class Person : Identifiable&lt;int&gt;
161+
public class Person : Identifiable&lt;long&gt;
162162
{
163163
[Attr(Capabilities = AttrCapabilities.AllowCreate)]
164164
public string? CreatorName { get; set; }
@@ -168,7 +168,7 @@ <h3 id="allowchange">AllowChange</h3>
168168
<p>Indicates whether PATCH requests can update the attribute value. When sent but not allowed, an HTTP 422 response is returned.</p>
169169
<pre><code class="lang-c#">#nullable enable
170170

171-
public class Person : Identifiable&lt;int&gt;
171+
public class Person : Identifiable&lt;long&gt;
172172
{
173173
[Attr(Capabilities = AttrCapabilities.AllowChange)]
174174
public string? FirstName { get; set; };
@@ -181,7 +181,7 @@ <h2 id="complex-attributes">Complex Attributes</h2>
181181
You can also use <a href="../options.html#customize-serializer-options">global options</a> to control the <code>JsonSerializer</code> behavior.</p>
182182
<pre><code class="lang-c#">#nullable enable
183183

184-
public class Foo : Identifiable&lt;int&gt;
184+
public class Foo : Identifiable&lt;long&gt;
185185
{
186186
[Attr]
187187
public Bar? Bar { get; set; }
@@ -200,7 +200,7 @@ <h2 id="complex-attributes">Complex Attributes</h2>
200200
and retrieval.</p>
201201
<pre><code class="lang-c#">#nullable enable
202202

203-
public class Foo : Identifiable&lt;int&gt;
203+
public class Foo : Identifiable&lt;long&gt;
204204
{
205205
[Attr]
206206
[NotMapped]

0 commit comments

Comments
 (0)