File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22
3+ using Microsoft . Data . SqlClient ;
4+
35namespace Mssql . McpServer ;
46
57public interface ISqlConnectionFactory
68{
7- Task < Microsoft . Data . SqlClient . SqlConnection > GetOpenConnectionAsync ( ) ;
8- }
9-
9+ Task < SqlConnection > GetOpenConnectionAsync ( ) ;
10+ }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ private static async Task Main(string[] args)
2727
2828 // Register ISqlConnectionFactory and Tools for DI
2929 _ = builder . Services . AddSingleton < ISqlConnectionFactory , SqlConnectionFactory > ( ) ;
30- _ = builder . Services . AddScoped < Tools > ( ) ;
30+ _ = builder . Services . AddSingleton < Tools > ( ) ;
3131
3232 // Register MCP server and tools (instance-based)
3333 _ = builder . Services
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22
3+ using Microsoft . Data . SqlClient ;
4+
35namespace Mssql . McpServer ;
46
57public class SqlConnectionFactory : ISqlConnectionFactory
68{
7- public async Task < Microsoft . Data . SqlClient . SqlConnection > GetOpenConnectionAsync ( )
9+ public async Task < SqlConnection > GetOpenConnectionAsync ( )
810 {
911 var connectionString = SqlConnectionManager . GetSqlConfig ( ) ;
10- var conn = new Microsoft . Data . SqlClient . SqlConnection ( connectionString ) ;
12+ var conn = new SqlConnection ( connectionString ) ;
1113 await conn . OpenAsync ( ) ;
1214 return conn ;
1315 }
You can’t perform that action at this time.
0 commit comments