|
using System;
using System.Collections.Generic;
namespace Light.Model
{
/// <summary>
/// Represents a command that can be used to build a database
/// command to be executed by Dao objects.
/// </summary>
public sealed class Command
{
private string text;
private List<Parameter> parameters = new List<Parameter>();
/// <summary>
/// Creates a new command with given SQL statement.
/// </summary>
public Command()
{
}
/// <summary>
/// Gets or sets the SQL statement of this command.
/// </summary>
public string Text
{
get { return text; }
set { text = value; }
}
/// <summary>
/// Gets the number of parameters.
/// </summary>
public int Count
{
get { return parameters.Count; }
}
/// <summary>
/// Adds a parameter created from a column with given name.
/// </summary>
/// <param name="p">parameter created from a column with given name</param>
public void Add(Parameter p)
{
parameters.Add(p);
}
/// <summary>
/// Returns a parameter at the given index.
/// </summary>
/// <param name="index">parameter index</param>
/// <returns>parameter at the given index</returns>
public Parameter Get(int index)
{
if(index >= 0 && index < parameters.Count)
return parameters[index];
return null;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.