Skip to content

Commit 7806cc4

Browse files
committed
fix(Attr/RelationshipAttibute): make setters internal
1 parent 10628aa commit 7806cc4

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

benchmarks/Query/QueryParser_Benchmarks.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ public QueryParser_Benchmarks() {
2424
var controllerContextMock = new Mock<IControllerContext>();
2525
controllerContextMock.Setup(m => m.RequestEntity).Returns(new ContextEntity {
2626
Attributes = new List<AttrAttribute> {
27-
new AttrAttribute(ATTRIBUTE) {
28-
InternalAttributeName = ATTRIBUTE
29-
}
27+
new AttrAttribute(ATTRIBUTE, ATTRIBUTE)
3028
}
3129
});
3230
var options = new JsonApiOptions();

src/JsonApiDotNetCore/AssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
[assembly:InternalsVisibleTo("UnitTests")]
33
[assembly:InternalsVisibleTo("JsonApiDotNetCoreExampleTests")]
44
[assembly:InternalsVisibleTo("NoEntityFrameworkTests")]
5+
[assembly:InternalsVisibleTo("Benchmarks")]

src/JsonApiDotNetCore/Models/AttrAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal AttrAttribute(string publicName, string internalName, bool isImmutable
2121
}
2222

2323
public string PublicAttributeName { get; }
24-
public string InternalAttributeName { get; }
24+
public string InternalAttributeName { get; internal set; }
2525
public bool IsImmutable { get; }
2626
public bool IsFilterable { get; }
2727
public bool IsSortable { get; }

src/JsonApiDotNetCore/Models/HasManyAttribute.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
using System.Reflection;
2-
31
namespace JsonApiDotNetCore.Models
42
{
53
public class HasManyAttribute : RelationshipAttribute
64
{
75
public HasManyAttribute(string publicName, Link documentLinks = Link.All)
86
: base(publicName, documentLinks)
9-
{
10-
PublicRelationshipName = publicName;
11-
}
7+
{ }
128

139
public override void SetValue(object entity, object newValue)
1410
{

src/JsonApiDotNetCore/Models/HasOneAttribute.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
using System.Reflection;
2-
31
namespace JsonApiDotNetCore.Models
42
{
53
public class HasOneAttribute : RelationshipAttribute
64
{
75
public HasOneAttribute(string publicName, Link documentLinks = Link.All)
86
: base(publicName, documentLinks)
9-
{
10-
PublicRelationshipName = publicName;
11-
}
7+
{ }
128

139
public override void SetValue(object entity, object newValue)
1410
{

src/JsonApiDotNetCore/Models/RelationshipAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ protected RelationshipAttribute(string publicName, Link documentLinks)
1111
}
1212

1313
public string PublicRelationshipName { get; }
14-
public string InternalRelationshipName { get; }
15-
public Type Type { get; }
14+
public string InternalRelationshipName { get; internal set; }
15+
public Type Type { get; internal set; }
1616
public bool IsHasMany => GetType() == typeof(HasManyAttribute);
1717
public bool IsHasOne => GetType() == typeof(HasOneAttribute);
1818
public Link DocumentLinks { get; } = Link.All;

0 commit comments

Comments
 (0)