Skip to content

Commit 18f6bac

Browse files
committed
refactor(Identifiable): there is no need to make Id abstract
1 parent e0a9583 commit 18f6bac

File tree

5 files changed

+2
-14
lines changed

5 files changed

+2
-14
lines changed

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ Your models should inherit `Identifiable<TId>` where `TId` is the type of the pr
7676

7777
```csharp
7878
public class Person : Identifiable<Guid>
79-
{
80-
public override Guid Id { get; set; }
81-
}
79+
{ }
8280
```
8381

8482
#### Specifying Public Attributes
@@ -89,8 +87,6 @@ add the `AttrAttribute` and provide the outbound name.
8987
```csharp
9088
public class Person : Identifiable<int>
9189
{
92-
public override int Id { get; set; }
93-
9490
[Attr("first-name")]
9591
public string FirstName { get; set; }
9692
}
@@ -104,8 +100,6 @@ they should be labeled as virtual.
104100
```csharp
105101
public class Person : Identifiable<int>
106102
{
107-
public override int Id { get; set; }
108-
109103
[Attr("first-name")]
110104
public string FirstName { get; set; }
111105

@@ -119,8 +113,6 @@ For example, a `TodoItem` may have an `Owner` and so the Id attribute should be
119113
```csharp
120114
public class TodoItem : Identifiable<int>
121115
{
122-
public override int Id { get; set; }
123-
124116
[Attr("description")]
125117
public string Description { get; set; }
126118

src/JsonApiDotNetCore/Models/Identifiable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace JsonApiDotNetCore.Models
22
{
33
public abstract class Identifiable<T> : IIdentifiable<T>, IIdentifiable
44
{
5-
public abstract T Id { get; set; }
5+
public T Id { get; set; }
66

77
object IIdentifiable.Id
88
{

src/JsonApiDotNetCoreExample/Models/Person.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ namespace JsonApiDotNetCoreExample.Models
77
{
88
public class Person : Identifiable<int>, IHasMeta
99
{
10-
public override int Id { get; set; }
11-
1210
[Attr("first-name")]
1311
public string FirstName { get; set; }
1412

src/JsonApiDotNetCoreExample/Models/TodoItem.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace JsonApiDotNetCoreExample.Models
55
{
66
public class TodoItem : Identifiable<int>
77
{
8-
public override int Id { get; set; }
98

109
[Attr("description")]
1110
public string Description { get; set; }

test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/DocumentTests/Included.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using JsonApiDotNetCoreExample.Data;
1414
using Bogus;
1515
using JsonApiDotNetCoreExample.Models;
16-
using System;
1716

1817
namespace JsonApiDotNetCoreExampleTests.Acceptance.Spec.DocumentTests
1918
{

0 commit comments

Comments
 (0)