Created
August 25, 2025 21:10
-
-
Save asmorger/44f8b7e9f043ffb89ff8e6c9f298b49c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface ISqlCommandFactory | |
| { | |
| SqlCommand GetCommand(SqlConnection connection, string storedProcedure, | |
| SqlParameter[]? parameters = null); | |
| } | |
| public class SqlCommandFactory : ISqlCommandFactory | |
| { | |
| public SqlCommand GetCommand(SqlConnection connection, string storedProcedure, | |
| SqlParameter[]? parameters = null) | |
| { | |
| var command = new SqlCommand(storedProcedure, connection) { CommandType = CommandType.StoredProcedure }; | |
| if(parameters != null) | |
| command.Parameters.AddRange(parameters); | |
| return command; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment