Skip to content

Commit f41c551

Browse files
committed
Rename AttributeValue to AttributeRecord
This aligns with the rename of `TrackedItem` to `TrackedRecord` (a6db252). This is a major breaking change, since `AttributeValue` is a long established class. That said, this avoids the awkward convention of e.g. `AttributeValue.Value`, and unifies the naming convention for combining metadata and values as a "Record". (As it so happens, this also _happens_ to be a C# 9.0 record type—though that's not why we're using this naming convention here.)
1 parent 6960800 commit f41c551

19 files changed

+107
-107
lines changed

OnTopic.Data.Sql/Models/AttributeValuesDataTable.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal AttributeValuesDataTable() {
3838
| COLUMN: Attribute Value
3939
\-----------------------------------------------------------------------------------------------------------------------*/
4040
Columns.Add(
41-
new DataColumn("AttributeValue") {
41+
new DataColumn("AttributeRecord") {
4242
MaxLength = 255
4343
}
4444
);
@@ -51,16 +51,16 @@ internal AttributeValuesDataTable() {
5151
/// <summary>
5252
/// Provides a convenience method for adding a new <see cref="DataRow"/> based on the expected column values.
5353
/// </summary>
54-
/// <param name="attributeKey">The <see cref="AttributeValue.Key"/>.</param>
55-
/// <param name="attributeValue">The <see cref="AttributeValue.Value"/>.</param>
54+
/// <param name="attributeKey">The <see cref="AttributeRecord.Key"/>.</param>
55+
/// <param name="attributeValue">The <see cref="AttributeRecord.Value"/>.</param>
5656
internal DataRow AddRow(string attributeKey, string? attributeValue = null) {
5757

5858
/*------------------------------------------------------------------------------------------------------------------------
5959
| Define record
6060
\-----------------------------------------------------------------------------------------------------------------------*/
6161
var record = NewRow();
6262
record["AttributeKey"] = attributeKey;
63-
record["AttributeValue"] = attributeValue;
63+
record["AttributeRecord"] = attributeValue;
6464

6565
/*------------------------------------------------------------------------------------------------------------------------
6666
| Add record

OnTopic.Data.Sql/SqlDataReaderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private static void SetIndexedAttributes(this IDataReader reader, TopicIndex top
237237
\-----------------------------------------------------------------------------------------------------------------------*/
238238
var topicId = reader.GetTopicId();
239239
var attributeKey = reader.GetString("AttributeKey");
240-
var attributeValue = reader.GetString("AttributeValue");
240+
var attributeValue = reader.GetString("AttributeRecord");
241241
var version = reader.GetVersion();
242242

243243
/*------------------------------------------------------------------------------------------------------------------------

OnTopic.TestDoubles/StubTopicRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected override void DeleteTopic(Topic topic) { }
139139
| METHOD: GET ATTRIBUTES (PROXY)
140140
\-------------------------------------------------------------------------------------------------------------------------*/
141141
/// <inheritdoc cref="TopicRepository.GetAttributes(Topic, Boolean?, Boolean?)" />
142-
public IEnumerable<AttributeValue> GetAttributesProxy(
142+
public IEnumerable<AttributeRecord> GetAttributesProxy(
143143
Topic topic,
144144
bool? isExtendedAttribute,
145145
bool? isDirty = null,

OnTopic.Tests/AttributeValueCollectionTest.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public void Clear_ExistingValues_IsDirty() {
317317
| TEST: SET VALUE: VALUE UNCHANGED: IS NOT DIRTY?
318318
\-------------------------------------------------------------------------------------------------------------------------*/
319319
/// <summary>
320-
/// Sets the value of a custom <see cref="AttributeValue"/> to the existing value and ensures it is <i>not</i> marked as
320+
/// Sets the value of a custom <see cref="AttributeRecord"/> to the existing value and ensures it is <i>not</i> marked as
321321
/// <see cref="TrackedRecord{T}.IsDirty"/>.
322322
/// </summary>
323323
[TestMethod]
@@ -336,7 +336,7 @@ public void SetValue_ValueUnchanged_IsNotDirty() {
336336
| TEST: IS DIRTY: DIRTY VALUES: RETURNS TRUE
337337
\-------------------------------------------------------------------------------------------------------------------------*/
338338
/// <summary>
339-
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeValue"/> that is marked as <see
339+
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeRecord"/> that is marked as <see
340340
/// cref="TrackedRecord{T}.IsDirty"/>. Confirms that <see cref="AttributeValueCollection.IsDirty(Boolean)"/> returns
341341
/// <c>true</c>.
342342
/// </summary>
@@ -355,7 +355,7 @@ public void IsDirty_DirtyValues_ReturnsTrue() {
355355
| TEST: IS DIRTY: DELETED VALUES: RETURNS TRUE
356356
\-------------------------------------------------------------------------------------------------------------------------*/
357357
/// <summary>
358-
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeValue"/> and then deletes it. Confirms
358+
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeRecord"/> and then deletes it. Confirms
359359
/// that <see cref="AttributeValueCollection.IsDirty(Boolean)"/> returns <c>true</c>.
360360
/// </summary>
361361
[TestMethod]
@@ -374,7 +374,7 @@ public void IsDirty_DeletedValues_ReturnsTrue() {
374374
| TEST: IS DIRTY: NO DIRTY VALUES: RETURNS FALSE
375375
\-------------------------------------------------------------------------------------------------------------------------*/
376376
/// <summary>
377-
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeValue"/> that is <i>not</i> marked as
377+
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeRecord"/> that is <i>not</i> marked as
378378
/// <see cref="TrackedRecord{T}.IsDirty"/>. Confirms that <see cref="AttributeValueCollection.IsDirty(Boolean)"/> returns
379379
/// <c>false</c>/
380380
/// </summary>
@@ -393,8 +393,8 @@ public void IsDirty_NoDirtyValues_ReturnsFalse() {
393393
| TEST: IS DIRTY: EXCLUDE LAST MODIFIED: RETURNS FALSE
394394
\-------------------------------------------------------------------------------------------------------------------------*/
395395
/// <summary>
396-
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeValue"/> that is <i>not</i> marked as
397-
/// <see cref="TrackedRecord{T}.IsDirty"/> as well as a <c>LastModified</c> <see cref="AttributeValue"/> that is. Confirms
396+
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeRecord"/> that is <i>not</i> marked as
397+
/// <see cref="TrackedRecord{T}.IsDirty"/> as well as a <c>LastModified</c> <see cref="AttributeRecord"/> that is. Confirms
398398
/// that <see cref="AttributeValueCollection.IsDirty(Boolean)"/> returns <c>false</c>.
399399
/// </summary>
400400
[TestMethod]
@@ -414,7 +414,7 @@ public void IsDirty_ExcludeLastModified_ReturnsFalse() {
414414
| TEST: IS DIRTY: MARK CLEAN: UPDATES LAST MODIFIED
415415
\-------------------------------------------------------------------------------------------------------------------------*/
416416
/// <summary>
417-
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeValue"/> and then deletes it. Confirms
417+
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeRecord"/> and then deletes it. Confirms
418418
/// that the <see cref="TrackedRecord{T}.LastModified"/> returns the new <c>version</c> after calling <see cref="
419419
/// TrackedRecordCollection{TItem, TValue, TAttribute}.MarkClean(DateTime?)"/>.
420420
/// </summary>
@@ -436,7 +436,7 @@ public void IsDirty_MarkClean_UpdatesLastModified() {
436436
| TEST: IS DIRTY: MARK CLEAN: RETURNS FALSE
437437
\-------------------------------------------------------------------------------------------------------------------------*/
438438
/// <summary>
439-
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeValue"/> and then deletes it. Confirms
439+
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeRecord"/> and then deletes it. Confirms
440440
/// that <see cref="AttributeValueCollection.IsDirty(Boolean)"/> returns <c>false</c> after calling <see cref="
441441
/// TrackedRecordCollection{TItem, TValue, TAttribute}.MarkClean(DateTime?)"/>.
442442
/// </summary>
@@ -460,7 +460,7 @@ public void IsDirty_MarkClean_ReturnsFalse() {
460460
| TEST: IS DIRTY: MARK ATTRIBUTE CLEAN: RETURNS FALSE
461461
\-------------------------------------------------------------------------------------------------------------------------*/
462462
/// <summary>
463-
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeValue"/> and then confirms that <see
463+
/// Populates the <see cref="AttributeValueCollection"/> with a <see cref="AttributeRecord"/> and then confirms that <see
464464
/// cref="TrackedRecordCollection{TItem, TValue, TAttribute}.IsDirty(String)"/> returns <c>false</c> for that attribute
465465
/// after calling <see cref="TrackedRecordCollection{TItem, TValue, TAttribute}.MarkClean(String, DateTime?)"/>.
466466
/// </summary>
@@ -481,7 +481,7 @@ public void IsDirty_MarkAttributeClean_ReturnsFalse() {
481481
\-------------------------------------------------------------------------------------------------------------------------*/
482482
/// <summary>
483483
/// Populates a <see cref="AttributeValueCollection"/> associated with an <see cref="Topic.IsNew"/> <see cref="Topic"/>
484-
/// with a <see cref="AttributeValue"/> that is not marked as <see cref="TrackedRecord{T}.IsDirty"/> and then confirms
484+
/// with a <see cref="AttributeRecord"/> that is not marked as <see cref="TrackedRecord{T}.IsDirty"/> and then confirms
485485
/// that <see cref="TrackedRecordCollection{TItem, TValue, TAttribute}.IsDirty()"/> returns <c>true</c>.
486486
/// </summary>
487487
[TestMethod]
@@ -506,7 +506,7 @@ public void IsDirty_AddCleanAttributeToNewTopic_ReturnsTrue() {
506506
\-------------------------------------------------------------------------------------------------------------------------*/
507507
/// <summary>
508508
/// Populates a <see cref="AttributeValueCollection"/> associated with an <see cref="Topic.IsNew"/> <see cref="Topic"/>
509-
/// with a <see cref="AttributeValue"/> and then confirms that <see cref="TrackedRecordCollection{TItem, TValue,
509+
/// with a <see cref="AttributeRecord"/> and then confirms that <see cref="TrackedRecordCollection{TItem, TValue,
510510
/// TAttribute}.IsDirty(String)"/> returns <c>true</c> for that attribute after calling <see cref="TrackedRecordCollection
511511
/// {TItem, TValue, TAttribute}.MarkClean(String, DateTime?)"/>.
512512
/// </summary>
@@ -542,7 +542,7 @@ public void SetValue_InvalidValue_ThrowsException() {
542542
| TEST: ADD: VALID ATTRIBUTE VALUE: IS RETURNED
543543
\-------------------------------------------------------------------------------------------------------------------------*/
544544
/// <summary>
545-
/// Sets a custom attribute on a topic by directly adding an <see cref="AttributeValue"/> instance; ensures it can be
545+
/// Sets a custom attribute on a topic by directly adding an <see cref="AttributeRecord"/> instance; ensures it can be
546546
/// retrieved.
547547
/// </summary>
548548
[TestMethod]
@@ -669,7 +669,7 @@ public void Add_InvalidAttributeValue_ThrowsException() {
669669
| TEST: REPLACE VALUE: WITH BUSINESS LOGIC: MAINTAINS ISDIRTY
670670
\-------------------------------------------------------------------------------------------------------------------------*/
671671
/// <summary>
672-
/// Adds a new <see cref="AttributeValue"/> which maps to <see cref="Topic.Key"/> directly to a <see cref=
672+
/// Adds a new <see cref="AttributeRecord"/> which maps to <see cref="Topic.Key"/> directly to a <see cref=
673673
/// "AttributeValueCollection"/> and confirms that the original <see cref="TrackedRecord{T}.IsDirty"/> is replaced if the
674674
/// <see cref="TrackedRecord{T}.Value"/> changes.
675675
/// </summary>
@@ -683,7 +683,7 @@ public void Add_WithBusinessLogic_MaintainsIsDirty() {
683683

684684
var index = topic.Attributes.IndexOf(originalValue);
685685

686-
topic.Attributes[index] = new AttributeValue("View", "NewValue", false);
686+
topic.Attributes[index] = new AttributeRecord("View", "NewValue", false);
687687
topic.Attributes.TryGetValue("View", out var newAttribute);
688688

689689
topic.Attributes.SetValue("View", "NewerValue", false);
@@ -699,7 +699,7 @@ public void Add_WithBusinessLogic_MaintainsIsDirty() {
699699
\-------------------------------------------------------------------------------------------------------------------------*/
700700
/// <summary>
701701
/// Adds a new attribute with an empty value, and confirms that it is <i>not</i> added as a new <see
702-
/// cref="AttributeValue"/>. Empty values are treated as the same as non-existent attributes. They are stored for the sake
702+
/// cref="AttributeRecord"/>. Empty values are treated as the same as non-existent attributes. They are stored for the sake
703703
/// of tracking <i>deleted</i> attributes, but should not be stored for <i>new</i> attributes.
704704
/// </summary>
705705
[TestMethod]
@@ -718,7 +718,7 @@ public void SetValue_EmptyAttributeValue_Skips() {
718718
\-------------------------------------------------------------------------------------------------------------------------*/
719719
/// <summary>
720720
/// Adds a new attribute with an empty value, and confirms that it is <i>is</i> added as a new <see
721-
/// cref="AttributeValue"/> assuming the value previously existed. Empty values are treated as the same as non-existent
721+
/// cref="AttributeRecord"/> assuming the value previously existed. Empty values are treated as the same as non-existent
722722
/// attributes, but they should be stored for the sake of tracking <i>deleted</i> attributes.
723723
/// </summary>
724724
[TestMethod]

OnTopic.Tests/Schemas/AttributesDataTable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public AttributesDataTable() : base("Attributes") {
5252
\-----------------------------------------------------------------------------------------------------------------------*/
5353
Columns.Add(new DataColumn() {
5454
DataType = typeof(string),
55-
ColumnName = "AttributeValue",
55+
ColumnName = "AttributeRecord",
5656
AllowDBNull = true
5757
});
5858

@@ -87,7 +87,7 @@ public void AddRow(int topicId, string attributeKey, string? attributeValue, Dat
8787

8888
row["TopicId"] = topicId;
8989
row["AttributeKey"] = attributeKey;
90-
row["AttributeValue"] = attributeValue is null? DBNull.Value : attributeValue;
90+
row["AttributeRecord"] = attributeValue is null? DBNull.Value : attributeValue;
9191
row["Version"] = version?? DateTime.UtcNow;
9292

9393
/*------------------------------------------------------------------------------------------------------------------------

OnTopic.Tests/TopicRepositoryBaseTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public void GetAttributes_AnyAttributes_ReturnsAllAttributes() {
219219
\-------------------------------------------------------------------------------------------------------------------------*/
220220
/// <summary>
221221
/// Retrieves a list of attributes from a topic, without any filtering by whether or not the attribute is an <see
222-
/// cref="AttributeDescriptor.IsExtendedAttribute"/>. Any <see cref="AttributeValue"/>s with a null or empty value should
222+
/// cref="AttributeDescriptor.IsExtendedAttribute"/>. Any <see cref="AttributeRecord"/>s with a null or empty value should
223223
/// be skipped.
224224
/// </summary>
225225
[TestMethod]
@@ -280,8 +280,8 @@ public void GetAttributes_ExtendedAttributes_ReturnsExtendedAttributes() {
280280
\-------------------------------------------------------------------------------------------------------------------------*/
281281
/// <summary>
282282
/// Retrieves a list of attributes from a topic, filtering by <see cref="TrackedRecord{T}.IsDirty"/>. Expects an <see
283-
/// cref="AttributeValue"/> to be returned even if it's <i>not</i> <see cref="TrackedRecord{T}.IsDirty"/> <i>but</i> its
284-
/// <see cref="AttributeValue.IsExtendedAttribute"/> disagrees with <see cref="AttributeDescriptor.IsExtendedAttribute"/>.
283+
/// cref="AttributeRecord"/> to be returned even if it's <i>not</i> <see cref="TrackedRecord{T}.IsDirty"/> <i>but</i> its
284+
/// <see cref="AttributeRecord.IsExtendedAttribute"/> disagrees with <see cref="AttributeDescriptor.IsExtendedAttribute"/>.
285285
/// </summary>
286286
[TestMethod]
287287
public void GetAttributes_ExtendedAttributeMismatch_ReturnsExtendedAttributes() {
@@ -302,7 +302,7 @@ public void GetAttributes_ExtendedAttributeMismatch_ReturnsExtendedAttributes()
302302
\-------------------------------------------------------------------------------------------------------------------------*/
303303
/// <summary>
304304
/// Retrieves a list of attributes from a topic, filtering by <see cref="TrackedRecord{T}.IsDirty"/>. Expects the <see
305-
/// cref="AttributeValue"/> to <i>not</i> be returned even though its <see cref="AttributeValue.IsExtendedAttribute"/>
305+
/// cref="AttributeRecord"/> to <i>not</i> be returned even though its <see cref="AttributeRecord.IsExtendedAttribute"/>
306306
/// disagrees with <see cref="AttributeDescriptor.IsExtendedAttribute"/>, since it won't match the <see
307307
/// cref="TopicRepository.GetAttributes(Topic, Boolean?, Boolean?, Boolean)"/>'s <c>isExtendedAttribute</c> call.
308308
/// </summary>
@@ -324,7 +324,7 @@ public void GetAttributes_ExtendedAttributeMismatch_ReturnsNothing() {
324324
\-------------------------------------------------------------------------------------------------------------------------*/
325325
/// <summary>
326326
/// Retrieves a list of attributes from a topic, filtering by <c>excludeLastModified</c>. Confirms that <see
327-
/// cref="AttributeValue"/>s are not returned which start with <c>LastModified</c>.
327+
/// cref="AttributeRecord"/>s are not returned which start with <c>LastModified</c>.
328328
/// </summary>
329329
[TestMethod]
330330
public void GetAttributes_ExcludeLastModified_ReturnsOtherAttributes() {
@@ -345,7 +345,7 @@ public void GetAttributes_ExcludeLastModified_ReturnsOtherAttributes() {
345345
\-------------------------------------------------------------------------------------------------------------------------*/
346346
/// <summary>
347347
/// Sets an arbitrary (unmatched) attribute on a <see cref="Topic"/> with a value shorter than 255 characters, then
348-
/// ensures that it is returned as an an <i>indexed</i> <see cref="AttributeValue"/> when calling <see
348+
/// ensures that it is returned as an an <i>indexed</i> <see cref="AttributeRecord"/> when calling <see
349349
/// cref="TopicRepository.GetAttributes(Topic, Boolean?, Boolean?, Boolean)"/>.
350350
/// </summary>
351351
[TestMethod]

OnTopic.Tests/TopicTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public void LastModified_UpdateValue_ReturnsExpectedValue() {
275275
\-------------------------------------------------------------------------------------------------------------------------*/
276276
/// <summary>
277277
/// Sets a base topic to a topic entity, then replaces the references with a new topic entity. Ensures that both the
278-
/// base topic as well as the underlying <see cref="AttributeValue"/> correctly reference the new value.
278+
/// base topic as well as the underlying <see cref="AttributeRecord"/> correctly reference the new value.
279279
/// </summary>
280280
[TestMethod]
281281
public void BaseTopic_UpdateValue_ReturnsExpectedValue() {

0 commit comments

Comments
 (0)