-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resource inheritance: write endpoints
- Loading branch information
Bart Koelman
committed
Mar 30, 2022
1 parent
4d34dcd
commit 68063dc
Showing
37 changed files
with
3,452 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/JsonApiDotNetCore/Resources/AbstractResourceWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace JsonApiDotNetCore.Resources; | ||
|
||
/// <inheritdoc cref="IAbstractResourceWrapper" /> | ||
internal sealed class AbstractResourceWrapper<TId> : Identifiable<TId>, IAbstractResourceWrapper | ||
{ | ||
/// <inheritdoc /> | ||
public Type AbstractType { get; } | ||
|
||
public AbstractResourceWrapper(Type abstractType) | ||
{ | ||
ArgumentGuard.NotNull(abstractType, nameof(abstractType)); | ||
|
||
AbstractType = abstractType; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/JsonApiDotNetCore/Resources/IAbstractResourceWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace JsonApiDotNetCore.Resources; | ||
|
||
/// <summary> | ||
/// Because an instance cannot be created from an abstract resource type, this wrapper is used to preserve that information. | ||
/// </summary> | ||
internal interface IAbstractResourceWrapper : IIdentifiable | ||
{ | ||
/// <summary> | ||
/// The abstract resource type. | ||
/// </summary> | ||
Type AbstractType { get; } | ||
} |
Oops, something went wrong.