Skip to content

Commit 07ff717

Browse files
committed
feat(relationship-attr): add hasMany and hasOne attribute
1 parent e05180e commit 07ff717

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace JsonApiDotNetCore.Models
2+
{
3+
public class HasManyAttribute : RelationshipAttribute
4+
{
5+
public HasManyAttribute(string publicName)
6+
: base(publicName)
7+
{
8+
PublicRelationshipName = publicName;
9+
}
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace JsonApiDotNetCore.Models
2+
{
3+
public class HasOneAttribute : RelationshipAttribute
4+
{
5+
public HasOneAttribute(string publicName)
6+
: base(publicName)
7+
{
8+
PublicRelationshipName = publicName;
9+
}
10+
}
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
3+
namespace JsonApiDotNetCore.Models
4+
{
5+
public class RelationshipAttribute : Attribute
6+
{
7+
protected RelationshipAttribute(string publicName)
8+
{
9+
PublicRelationshipName = publicName;
10+
}
11+
12+
public string PublicRelationshipName { get; set; }
13+
public string InternalRelationshipName { get; set; }
14+
}
15+
}

0 commit comments

Comments
 (0)