Skip to content

Commit 19a6dd5

Browse files
Manually perform JADNC Full Cleanup
1 parent 71e437d commit 19a6dd5

File tree

7 files changed

+189
-131
lines changed

7 files changed

+189
-131
lines changed

src/JsonApiDotNetCore/Configuration/NoSqlServiceCollectionExtensions.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,39 @@
1212
namespace JsonApiDotNetCore.Configuration
1313
{
1414
/// <summary>
15-
/// Provides extension methods for the registration of services and other injectables
16-
/// with the service container.
15+
/// Provides extension methods for the registration of services and other injectables with the service container.
1716
/// </summary>
1817
[PublicAPI]
1918
public static class NoSqlServiceCollectionExtensions
2019
{
2120
/// <summary>
22-
/// For each resource annotated with the <see cref="NoSqlResourceAttribute" />, adds a
23-
/// scoped service with a service type of <see cref="IResourceService{TResource, TId}" />
24-
/// and an implementation type of <see cref="NoSqlResourceService{TResource,TId}" />.
21+
/// For each resource annotated with the <see cref="NoSqlResourceAttribute" />, adds a scoped service with a service type of
22+
/// <see cref="IResourceService{TResource,TId}" /> and an implementation type of <see cref="NoSqlResourceService{TResource,TId}" />.
2523
/// </summary>
26-
/// <param name="services">The <see cref="IServiceCollection" />.</param>
27-
/// <returns>The <see cref="IServiceCollection" />.</returns>
24+
/// <param name="services">
25+
/// The <see cref="IServiceCollection" />.
26+
/// </param>
27+
/// <returns>
28+
/// The <see cref="IServiceCollection" />.
29+
/// </returns>
2830
public static IServiceCollection AddNoSqlResourceServices(this IServiceCollection services)
2931
{
3032
return services.AddNoSqlResourceServices(Assembly.GetCallingAssembly());
3133
}
3234

3335
/// <summary>
34-
/// For each resource annotated with the <see cref="NoSqlResourceAttribute" />, adds a
35-
/// scoped service with a service type of <see cref="IResourceService{TResource, TId}" />
36-
/// and an implementation type of <see cref="NoSqlResourceService{TResource,TId}" />.
36+
/// For each resource annotated with the <see cref="NoSqlResourceAttribute" />, adds a scoped service with a service type of
37+
/// <see cref="IResourceService{TResource, TId}" /> and an implementation type of <see cref="NoSqlResourceService{TResource,TId}" />.
3738
/// </summary>
38-
/// <param name="services">The <see cref="IServiceCollection" />.</param>
39-
/// <param name="assembly">The <see cref="Assembly" /> containing the annotated resources.</param>
40-
/// <returns>The <see cref="IServiceCollection" />.</returns>
39+
/// <param name="services">
40+
/// The <see cref="IServiceCollection" />.
41+
/// </param>
42+
/// <param name="assembly">
43+
/// The <see cref="Assembly" /> containing the annotated resources.
44+
/// </param>
45+
/// <returns>
46+
/// The <see cref="IServiceCollection" />.
47+
/// </returns>
4148
public static IServiceCollection AddNoSqlResourceServices(this IServiceCollection services, Assembly assembly)
4249
{
4350
services.AddScoped<INoSqlQueryLayerComposer, NoSqlQueryLayerComposer>();

src/JsonApiDotNetCore/Queries/INoSqlQueryLayerComposer.cs

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,26 @@
55
namespace JsonApiDotNetCore.Queries
66
{
77
/// <summary>
8-
/// Takes scoped expressions from <see cref="IQueryConstraintProvider" />s and transforms them.
9-
/// Additionally provides specific transformations for NoSQL databases without support for joins.
8+
/// Takes scoped expressions from <see cref="IQueryConstraintProvider" />s and transforms them. Additionally provides specific transformations for NoSQL
9+
/// databases without support for joins.
1010
/// </summary>
1111
[PublicAPI]
1212
public interface INoSqlQueryLayerComposer
1313
{
1414
/// <summary>
15-
/// Builds a filter from constraints, used to determine total resource count on a primary
16-
/// collection endpoint.
15+
/// Builds a filter from constraints, used to determine total resource count on a primary collection endpoint.
1716
/// </summary>
1817
FilterExpression? GetPrimaryFilterFromConstraintsForNoSql(ResourceType primaryResourceType);
1918

2019
/// <summary>
21-
/// Composes a <see cref="QueryLayer" /> and an <see cref="IncludeExpression" /> from the
22-
/// constraints specified by the request. Used for primary resources.
20+
/// Composes a <see cref="QueryLayer" /> and an <see cref="IncludeExpression" /> from the constraints specified by the request. Used for primary
21+
/// resources.
2322
/// </summary>
2423
(QueryLayer QueryLayer, IncludeExpression Include) ComposeFromConstraintsForNoSql(ResourceType requestResourceType);
2524

2625
/// <summary>
27-
/// Composes a <see cref="QueryLayer" /> and an <see cref="IncludeExpression" /> from the
28-
/// constraints specified by the request. Used for primary resources.
26+
/// Composes a <see cref="QueryLayer" /> and an <see cref="IncludeExpression" /> from the constraints specified by the request. Used for primary
27+
/// resources.
2928
/// </summary>
3029
(QueryLayer QueryLayer, IncludeExpression Include) ComposeForGetByIdWithConstraintsForNoSql<TId>(
3130
TId id,
@@ -40,27 +39,34 @@ QueryLayer ComposeForGetByIdForNoSql<TId>(TId id, ResourceType primaryResourceTy
4039
where TId : notnull;
4140

4241
/// <summary>
43-
/// Composes a <see cref="QueryLayer" /> from the constraints specified by the request
44-
/// and a filter expression in the form "equals({propertyName},'{propertyValue}')".
45-
/// Used for secondary or included resources.
42+
/// Composes a <see cref="QueryLayer" /> from the constraints specified by the request and a filter expression in the form
43+
/// "equals({propertyName},'{propertyValue}')". Used for secondary or included resources.
4644
/// </summary>
47-
/// <param name="requestResourceType">The <see cref="ResourceType" /> of the secondary or included resource.</param>
48-
/// <param name="propertyName">The name of the property of the secondary or included resource used for filtering.</param>
49-
/// <param name="propertyValue">The value of the property of the secondary or included resource used for filtering.</param>
45+
/// <param name="requestResourceType">
46+
/// The <see cref="ResourceType" /> of the secondary or included resource.
47+
/// </param>
48+
/// <param name="propertyName">
49+
/// The name of the property of the secondary or included resource used for filtering.
50+
/// </param>
51+
/// <param name="propertyValue">
52+
/// The value of the property of the secondary or included resource used for filtering.
53+
/// </param>
5054
/// <param name="isIncluded">
51-
/// <see langword="true" />, if the resource is included by the request (e.g., "{url}?include={relationshipName}");
52-
/// <see langword="false" />, if the resource is a secondary resource (e.g., "/{primary}/{id}/{relationshipName}").
55+
/// <see langword="true" />, if the resource is included by the request (e.g., "{url}?include={relationshipName}"); <see langword="false" />, if the
56+
/// resource is a secondary resource (e.g., "/{primary}/{id}/{relationshipName}").
5357
/// </param>
54-
/// <returns>A tuple with a <see cref="QueryLayer" /> and an <see cref="IncludeExpression" />.</returns>
58+
/// <returns>
59+
/// A tuple with a <see cref="QueryLayer" /> and an <see cref="IncludeExpression" />.
60+
/// </returns>
5561
(QueryLayer QueryLayer, IncludeExpression Include) ComposeFromConstraintsForNoSql(
5662
ResourceType requestResourceType,
5763
string propertyName,
5864
string propertyValue,
5965
bool isIncluded);
6066

6167
/// <summary>
62-
/// Builds a query that retrieves the primary resource, including all of its attributes
63-
/// and all targeted relationships, during a create/update/delete request.
68+
/// Builds a query that retrieves the primary resource, including all of its attributes and all targeted relationships, during a create/update/delete
69+
/// request.
6470
/// </summary>
6571
(QueryLayer QueryLayer, IncludeExpression Include) ComposeForUpdateForNoSql<TId>(TId id, ResourceType primaryResourceType)
6672
where TId : notnull;

src/JsonApiDotNetCore/Queries/NoSqlQueryLayerComposer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ namespace JsonApiDotNetCore.Queries
1717
/// Default implementation of the <see cref="INoSqlQueryLayerComposer" />.
1818
/// </summary>
1919
/// <remarks>
20-
/// Register <see cref="NoSqlQueryLayerComposer"/> with the service container as
21-
/// shown in the following example.
20+
/// Register <see cref="NoSqlQueryLayerComposer" /> with the service container as shown in the following example.
2221
/// </remarks>
2322
/// <example>
2423
/// <code><![CDATA[

src/JsonApiDotNetCore/Resources/Annotations/NoSqlHasForeignKeyAttribute.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,20 @@ namespace JsonApiDotNetCore.Resources.Annotations
3030
[AttributeUsage(AttributeTargets.Property)]
3131
public class NoSqlHasForeignKeyAttribute : Attribute
3232
{
33-
public NoSqlHasForeignKeyAttribute(string propertyName)
34-
{
35-
PropertyName = propertyName;
36-
}
37-
3833
/// <summary>
39-
/// Gets the name of the foreign key property corresponding to the annotated
40-
/// navigation property.
34+
/// Gets the name of the foreign key property corresponding to the annotated navigation property.
4135
/// </summary>
4236
public string PropertyName { get; private set; }
4337

4438
/// <summary>
45-
/// Gets or sets a value indicating whether the navigation property is on
46-
/// the dependent side of the foreign key relationship. The default is
39+
/// Gets or sets a value indicating whether the navigation property is on the dependent side of the foreign key relationship. The default is
4740
/// <see langword="true" />.
4841
/// </summary>
4942
public bool IsDependent { get; set; } = true;
43+
44+
public NoSqlHasForeignKeyAttribute(string propertyName)
45+
{
46+
PropertyName = propertyName;
47+
}
5048
}
5149
}

src/JsonApiDotNetCore/Resources/Annotations/NoSqlOwnsManyAttribute.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,14 @@
44
namespace JsonApiDotNetCore.Resources.Annotations
55
{
66
/// <summary>
7-
/// Used to provide additional information for a JSON:API relationship
8-
/// (https://jsonapi.org/format/#document-resource-object-relationships).
7+
/// Used to provide additional information for a JSON:API relationship (https://jsonapi.org/format/#document-resource-object-relationships).
98
/// </summary>
109
/// <remarks>
11-
/// With Cosmos DB, for example, an entity can own one or many other entity types.
12-
/// In the example below, an Author entity owns many Article entities, which is also
13-
/// reflected in the Entity Framework Core model. This means that all owned Article
14-
/// entities will be returned with the Author. To represent Article entities as a
15-
/// to-many relationship, the [HasMany] and [NoSqlOwnsMany] annotations can be combined
16-
/// to indicate to the NoSQL resource service that those Article resources do not have
17-
/// to be fetched. To include the Article resources into the response, the request will
18-
/// have to add an include expression such as "?include=articles". Otherwise, the
19-
/// Article resources will not be returned.
10+
/// With Cosmos DB, for example, an entity can own one or many other entity types. In the example below, an Author entity owns many Article entities,
11+
/// which is also reflected in the Entity Framework Core model. This means that all owned Article entities will be returned with the Author. To represent
12+
/// Article entities as a to-many relationship, the [HasMany] and [NoSqlOwnsMany] annotations can be combined to indicate to the NoSQL resource service
13+
/// that those Article resources do not have to be fetched. To include the Article resources into the response, the request will have to add an include
14+
/// expression such as "?include=articles". Otherwise, the Article resources will not be returned.
2015
/// </remarks>
2116
/// <example>
2217
/// <code><![CDATA[

src/JsonApiDotNetCore/Resources/Annotations/NoSqlResourceAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace JsonApiDotNetCore.Resources.Annotations
99
/// <summary>
1010
/// When put on a resource class, marks that resource as being hosted in a NoSQL database.
1111
/// </summary>
12-
/// <seealso cref="NoSqlServiceCollectionExtensions.AddNoSqlResourceServices(IServiceCollection)"/>
13-
/// <seealso cref="NoSqlServiceCollectionExtensions.AddNoSqlResourceServices(IServiceCollection, Assembly)"/>
12+
/// <seealso cref="NoSqlServiceCollectionExtensions.AddNoSqlResourceServices(IServiceCollection)" />
13+
/// <seealso cref="NoSqlServiceCollectionExtensions.AddNoSqlResourceServices(IServiceCollection, Assembly)" />
1414
[PublicAPI]
1515
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]
1616
public class NoSqlResourceAttribute : Attribute

0 commit comments

Comments
 (0)