Created
February 12, 2021 08:48
-
-
Save mttchpmn/ff58991081637b060c858ac7be681125 to your computer and use it in GitHub Desktop.
C# DbCommand Class
This file contains 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
using System; | |
namespace Sandbox | |
{ | |
public class DbCommand | |
{ | |
private DbConnection _connection; | |
public string Command { get; set; } | |
public DbCommand(DbConnection connection, string command) | |
{ | |
_connection = connection ?? throw new ArgumentException("DbConnection can not be null."); | |
Command = command ?? throw new ArgumentException("DB Command can not be null."); | |
} | |
public void Execute() | |
{ | |
_connection.Open(); | |
Console.WriteLine(Command); | |
_connection.Close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment