Skip to content

Commit 44dc3eb

Browse files
committed
Renamed PropertyConfiguration.RelationshipKey to CollectionKey
With the renaming of `[Relationship()]` to `[Collection()]` (f84ae66), it makes sense to rename the `PropertyConfiguration`'s `RelationshipKey` property to `CollectionKey`, since it maps to the `CollectionAttribute.Key` property.
1 parent 1daf799 commit 44dc3eb

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

OnTopic/Mapping/Internal/PropertyConfiguration.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public PropertyConfiguration(PropertyInfo property, string? attributePrefix = ""
6767
AttributePrefix = attributePrefix;
6868
DefaultValue = null;
6969
InheritValue = false;
70-
RelationshipKey = AttributeKey;
70+
CollectionKey = AttributeKey;
7171
CollectionType = CollectionType.Any;
7272
CrawlRelationships = Relationships.None;
7373
MetadataKey = null;
@@ -95,12 +95,12 @@ public PropertyConfiguration(PropertyInfo property, string? attributePrefix = ""
9595
GetAttributeValue<CollectionAttribute>(
9696
property,
9797
a => {
98-
RelationshipKey = a.Key ?? RelationshipKey;
98+
CollectionKey = a.Key ?? CollectionKey;
9999
CollectionType = a.Type;
100100
}
101101
);
102102

103-
if (RelationshipKey.Equals("Children", StringComparison.OrdinalIgnoreCase)) {
103+
if (CollectionKey.Equals("Children", StringComparison.OrdinalIgnoreCase)) {
104104
CollectionType = CollectionType.Children;
105105
}
106106

@@ -244,15 +244,15 @@ public PropertyConfiguration(PropertyInfo property, string? attributePrefix = ""
244244
/// So, for instance, if the property on the DTO class is called <c>Cousins</c> then the <see
245245
/// cref="ITopicMappingService"/> will search <see cref="Topic.Relationships"/>, <see
246246
/// cref="Topic.IncomingRelationships"/>, and, finally, <see cref="Topic.Children"/> for an object named <c>Cousins</c>.
247-
/// If the <see cref="RelationshipKey"/> is set, however, then that value is used instead, thus allowing the property on
247+
/// If the <see cref="CollectionKey"/> is set, however, then that value is used instead, thus allowing the property on
248248
/// the DTO to be aliased to a different collection name on the source <see cref="Topic"/>.
249249
/// </para>
250250
/// <para>
251-
/// The <see cref="RelationshipKey"/> property corresponds to the <see cref="CollectionAttribute.Key"/> property. It
251+
/// The <see cref="CollectionKey"/> property corresponds to the <see cref="CollectionAttribute.Key"/> property. It
252252
/// can be assigned by decorating a DTO property with e.g. <c>[Relationship("AlternateRelationshipKey")]</c>.
253253
/// </para>
254254
/// </remarks>
255-
public string RelationshipKey { get; set; }
255+
public string CollectionKey { get; set; }
256256

257257
/*==========================================================================================================================
258258
| PROPERTY: RELATIONSHIP TYPE
@@ -265,7 +265,7 @@ public PropertyConfiguration(PropertyInfo property, string? attributePrefix = ""
265265
/// By default, a collection property on a DTO class will attempt to find a match from, in order, <see
266266
/// cref="Topic.Relationships"/>, <see cref="Topic.IncomingRelationships"/>, and, finally, <see cref="Topic.Children"/>.
267267
/// If the <see cref="CollectionType"/> is set, however, then the <see cref="ITopicMappingService"/> will <i>only</i>
268-
/// map the collection to a relationship of that type. This can be valuable when the <see cref="RelationshipKey"/> might
268+
/// map the collection to a relationship of that type. This can be valuable when the <see cref="CollectionKey"/> might
269269
/// be ambiguous between multiple collections.
270270
/// </para>
271271
/// <para>

OnTopic/Mapping/TopicMappingService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ private IList<Topic> GetSourceCollection(Topic source, Relationships relationshi
521521
| Establish source collection to store topics to be mapped
522522
\-----------------------------------------------------------------------------------------------------------------------*/
523523
var listSource = (IList<Topic>)Array.Empty<Topic>();
524-
var relationshipKey = configuration.RelationshipKey;
524+
var relationshipKey = configuration.CollectionKey;
525525
var collectionType = configuration.CollectionType;
526526

527527
/*------------------------------------------------------------------------------------------------------------------------
@@ -616,7 +616,7 @@ IList<Topic> GetRelationship(CollectionType relationship, Func<string, bool> con
616616
(collectionType is CollectionType.Any || collectionType.Equals(relationship)) &&
617617
(collectionType is CollectionType.Children || relationship is not CollectionType.Children) &&
618618
(targetRelationships is Relationships.None || relationships.HasFlag(targetRelationships)) &&
619-
contains(configuration.RelationshipKey);
619+
contains(configuration.CollectionKey);
620620
return preconditionsMet? getTopics() : listSource;
621621
}
622622

0 commit comments

Comments
 (0)