Click here to Skip to main content
12,512,515 members (60,676 online)
Click here to Skip to main content
Articles » Database » Database » ADO.NET » Downloads

Stats

158.3K views
2.8K downloads
183 bookmarked
Posted

Light ORM Library for .NET

, 8 Oct 2010 CPOL
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)

Share

About the Author

Sergey Busel
Software Developer (Senior)
United States United States
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160929.1 | Last Updated 8 Oct 2010
Article Copyright 2007 by Sergey Busel
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid