Skip to content

Commit 412ab89

Browse files
committed
remove unnecessary code
1 parent 9c52b77 commit 412ab89

File tree

2 files changed

+0
-51
lines changed

2 files changed

+0
-51
lines changed

src/JsonApiDotNetCore/Builders/ContextGraphBuilder.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,10 @@ protected virtual List<RelationshipAttribute> GetRelationships(Type entityType)
191191
// Article → ArticleTag.Article
192192
hasManyThroughAttribute.LeftProperty = throughProperties.SingleOrDefault(x => x.PropertyType == entityType)
193193
?? throw new JsonApiSetupException($"{hasManyThroughAttribute.ThroughType} does not contain a navigation property to type {entityType}");
194-
195-
// ArticleTag.ArticleId
196-
var leftIdPropertyName = hasManyThroughAttribute.GetIdentityPropertyName(hasManyThroughAttribute.LeftProperty);
197-
hasManyThroughAttribute.LeftIdProperty = throughProperties.SingleOrDefault(p => p.Name == leftIdPropertyName)
198-
?? throw new JsonApiSetupException($"{hasManyThroughAttribute.ThroughType} does not contain an identity property {leftIdPropertyName}");
199194

200195
// Article → ArticleTag.Tag
201196
hasManyThroughAttribute.RightProperty = throughProperties.SingleOrDefault(x => x.PropertyType == hasManyThroughAttribute.Type)
202197
?? throw new JsonApiSetupException($"{hasManyThroughAttribute.ThroughType} does not contain a navigation property to type {hasManyThroughAttribute.Type}");
203-
204-
// ArticleTag.TagId
205-
var rightIdPropertyName = hasManyThroughAttribute.GetIdentityPropertyName(hasManyThroughAttribute.RightProperty);
206-
hasManyThroughAttribute.RightIdProperty = throughProperties.SingleOrDefault(p => p.Name == rightIdPropertyName)
207-
?? throw new JsonApiSetupException($"{hasManyThroughAttribute.ThroughType} does not contain an identity property {rightIdPropertyName}");
208198
}
209199
}
210200

src/JsonApiDotNetCore/Models/HasManyThroughAttribute.cs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,6 @@ public HasManyThroughAttribute(string publicName, string internalThroughName, Li
9595
/// </example>
9696
public PropertyInfo LeftProperty { get; internal set; }
9797

98-
/// <summary>
99-
/// The identity property back to the parent resource.
100-
/// </summary>
101-
///
102-
/// <example>
103-
/// In the `[HasManyThrough("tags", nameof(ArticleTags))]` example
104-
/// this would point to the `Article.ArticleTags.ArticleId` property
105-
///
106-
/// <code>
107-
/// public int ArticleId { get; set; }
108-
/// </code>
109-
///
110-
/// </example>
111-
public PropertyInfo LeftIdProperty { get; internal set; }
112-
11398
/// <summary>
11499
/// The navigation property to the related resource from the join type.
115100
/// </summary>
@@ -125,32 +110,6 @@ public HasManyThroughAttribute(string publicName, string internalThroughName, Li
125110
/// </example>
126111
public PropertyInfo RightProperty { get; internal set; }
127112

128-
/// <summary>
129-
/// The identity property back to the related resource from the join type.
130-
/// </summary>
131-
///
132-
/// <example>
133-
/// In the `[HasManyThrough("tags", nameof(ArticleTags))]` example
134-
/// this would point to the `Article.ArticleTags.TagId` property
135-
///
136-
/// <code>
137-
/// public int TagId { get; set; }
138-
/// </code>
139-
///
140-
/// </example>
141-
public PropertyInfo RightIdProperty { get; internal set; }
142-
143-
/// <summary>
144-
/// Get the name of the identity property from the navigation property.
145-
/// </summary>
146-
///
147-
/// <example>
148-
/// In the `[HasManyThrough("tags", nameof(ArticleTags))]` example
149-
/// this would translate to the `Article.ArticleTags.Tag` property
150-
/// to TagId. This is then used to set the Left and RightIdProperties.
151-
/// </example>
152-
public virtual string GetIdentityPropertyName(PropertyInfo property) => property.Name + "Id";
153-
154113
/// <summary>
155114
/// The join entity property on the parent resource.
156115
/// </summary>

0 commit comments

Comments
 (0)