Skip to content

Instantly share code, notes, and snippets.

@mttchpmn
Created February 12, 2021 08:48
Show Gist options
  • Save mttchpmn/ff58991081637b060c858ac7be681125 to your computer and use it in GitHub Desktop.
Save mttchpmn/ff58991081637b060c858ac7be681125 to your computer and use it in GitHub Desktop.
C# DbCommand Class
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