Skip to content

.NET: Replace inline string literals with constants in ChatHistoryMemoryProvider#4096

Open
westey-m wants to merge 2 commits intomicrosoft:mainfrom
westey-m:fix/chat-history-memory-string-consts
Open

.NET: Replace inline string literals with constants in ChatHistoryMemoryProvider#4096
westey-m wants to merge 2 commits intomicrosoft:mainfrom
westey-m:fix/chat-history-memory-string-consts

Conversation

@westey-m
Copy link
Contributor

Summary

Extract 11 private const string fields for vector store property names in ChatHistoryMemoryProvider and replace all inline string literal usages.

Constants added

KeyField, RoleField, MessageIdField, AuthorNameField, ApplicationIdField, AgentIdField, UserIdField, SessionIdField, ContentField, CreatedAtField, ContentEmbeddingField

Locations updated

  • Collection definition (VectorStoreCollectionDefinition)
  • Store dictionary in StoreAIContextAsync
  • Search result access in SearchTextAsync
  • Filter expressions in SearchChatHistoryAsync

No public API changes. All existing tests pass.

Fixes #3801

…vider

Extract 11 private const string fields for vector store property names
(Key, Role, MessageId, AuthorName, ApplicationId, AgentId, UserId,
SessionId, Content, CreatedAt, ContentEmbedding) and replace all inline
usages across the collection definition, store dictionary, search result
access, and filter expressions.

Fixes microsoft#3801

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 19, 2026 19:02
@github-actions github-actions bot changed the title Replace inline string literals with constants in ChatHistoryMemoryProvider .NET: Replace inline string literals with constants in ChatHistoryMemoryProvider Feb 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses issue #3801 by refactoring the ChatHistoryMemoryProvider class to eliminate inline string literals in favor of named constants for field names. The changes improve code maintainability by centralizing field name definitions and reducing the risk of typos.

Changes:

  • Added 11 private const string fields for vector store property names
  • Replaced all inline string literal usages with the corresponding constants across the class
  • Updated collection definition, storage dictionary, search result access, and filter expressions

@westey-m westey-m enabled auto-merge February 19, 2026 19:19
@westey-m westey-m added this pull request to the merge queue Feb 19, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 19, 2026
@westey-m westey-m added this pull request to the merge queue Feb 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Use consts in ChatHistoryMemoryProvider for field names instead of inline strings

5 participants

Comments