Skip to content

fix: Update SqlConversationRepository to use ODBC instead of SQL Server Client#327

Open
Ragini-Microsoft wants to merge 1 commit intomainfrom
rc-odbcref-main
Open

fix: Update SqlConversationRepository to use ODBC instead of SQL Server Client#327
Ragini-Microsoft wants to merge 1 commit intomainfrom
rc-odbcref-main

Conversation

@Ragini-Microsoft
Copy link
Copy Markdown
Collaborator

Purpose

This pull request refactors the SqlConversationRepository class to use ODBC for all database operations instead of the previous mix of SqlClient and Azure Identity. The code now consistently uses OdbcConnection and parameterized queries with positional parameters, simplifying the authentication and connection logic for both production and development environments. Additionally, exception handling and parameter usage have been updated to match these changes.

Migration to ODBC for Database Access:

  • Replaced all usage of SqlConnection, SqlCommand, and SqlParameter with OdbcConnection, OdbcCommand, and positional parameters throughout SqlConversationRepository. This includes all CRUD operations for conversations and messages. [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Updated all SQL queries to use ? as parameter placeholders (required by ODBC) instead of named parameters (e.g., @c, @u). Parameters are now added in the correct order using AddWithValue. [1] [2] [3] [4] [5] [6] [7] [8]

Connection and Authentication Logic:

  • Simplified connection logic: in production, the code now directly uses the FABRIC_SQL_CONNECTION_STRING with ODBC; in development, it builds an ODBC connection string with ActiveDirectoryInteractive authentication, removing Azure Identity and token management. The IAzureCredentialFactory dependency was removed. [1] [2]

Exception Handling Updates:

  • Updated exception handling to catch OdbcException instead of SqlException and improved the general exception filter to avoid swallowing ODBC and related exceptions. [1] [2]

These changes ensure consistent use of ODBC for SQL Server access, reduce external dependencies, and make the codebase easier to maintain and deploy across environments.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

@github-actions
Copy link
Copy Markdown

.NET Unit Test Results

201 tests   201 ✅  1s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 74b690e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant