Skip to content

Commit cd2497d

Browse files
committed
Ensured consistent casing for TopicID
In C#, identifiers ending in `ID` use PascalCase—i.e., `Id`. In SQL, however, we maintain the capitalization. This is confusing and, perhaps, our standard should be revisited. In the meanwhile, however, these standards should be applied consistently. And since the column names use `ID`, the stored procedures referencing those column names should similarly use `ID` (e.g., `Source_TopicID`, `TopicID`). Technically, these mismatches don't hurt anything, but the inconsistency can lead to confusion.
1 parent 6a5f671 commit cd2497d

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

OnTopic.Data.Sql.Database/Stored Procedures/UpdateRelationships.sql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@ DECLARE @Existing_TopicIDs TopicList
2020
--------------------------------------------------------------------------------------------------------------------------------
2121
INSERT
2222
INTO @Existing_TopicIDs (
23-
TopicId
23+
TopicID
2424
)
25-
SELECT Target_TopicId
25+
SELECT Target_TopicID
2626
FROM Relationships
27-
WHERE Source_TopicId = @TopicID
27+
WHERE Source_TopicID = @TopicID
2828
AND RelationshipKey = @RelationshipKey
2929

3030
--------------------------------------------------------------------------------------------------------------------------------
3131
-- INSERT NOVEL VALUES
3232
--------------------------------------------------------------------------------------------------------------------------------
3333
INSERT
3434
INTO Relationships (
35-
Source_TopicId,
35+
Source_TopicID,
3636
RelationshipKey,
37-
Target_TopicId
37+
Target_TopicID
3838
)
3939
SELECT @TopicId,
4040
@RelationshipKey,
41-
Target.TopicId
41+
Target.TopicID
4242
FROM @RelatedTopics Target
4343
FULL JOIN @Existing_TopicIDs Existing
44-
ON Existing.TopicId = Target.TopicId
45-
WHERE Existing.TopicId is null
44+
ON Existing.TopicID = Target.TopicID
45+
WHERE Existing.TopicID is null
4646

4747
--------------------------------------------------------------------------------------------------------------------------------
4848
-- RETURN TOPIC ID

OnTopic.Data.Sql.Database/Types/TopicList.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
CREATE
88
TYPE [dbo].[TopicList]
99
AS TABLE (
10-
TopicId INT NOT NULL
11-
PRIMARY KEY ( TopicId )
10+
TopicID INT NOT NULL
11+
PRIMARY KEY ( TopicID )
1212
)

OnTopic.Data.Sql/SqlTopicRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ private static void SetVersionHistory(SqlDataReader reader, Dictionary<int, Topi
342342
/*------------------------------------------------------------------------------------------------------------------------
343343
| Identify attributes
344344
\-----------------------------------------------------------------------------------------------------------------------*/
345-
var sourceTopicId = Int32.Parse(reader?["TopicId"]?.ToString(), CultureInfo.InvariantCulture);
345+
var sourceTopicId = Int32.Parse(reader?["TopicID"]?.ToString(), CultureInfo.InvariantCulture);
346346
var dateTime = reader?.GetDateTime(reader?.GetOrdinal("Version")?? 0)?? DateTime.Now;
347347

348348
/*------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)