Click here to Skip to main content
15,886,806 members
Articles / Database Development / SQL Server

Light ORM Library for .NET

Rate me:
Please Sign up or sign in to vote.
4.83/5 (39 votes)
8 Oct 2010CPOL17 min read 221.2K   3.1K   184  
This article is about the Light Object-Relational Mapping library.
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions