Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » ADO.NET » Downloads
 
Add your own
alternative version
Go to top

Light ORM Library for .NET

, 8 Oct 2010
This article is about the Light Object-Relational Mapping library.
using System;

namespace Light
{
	/// <summary>
	/// Marks a class, interface, or a struct as being a representation of a table record.
	/// </summary>
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct,
					Inherited=false, AllowMultiple=false)]
	public class TableAttribute : Attribute
	{
		private string name;
		private string schema;
		private string sequence;
		private bool inherit = false;
		private bool readOnly = false;
		
		/// <summary>
		/// Marks a class, interface, or a struct as being a representation of a table record.
		/// </summary>
		public TableAttribute() : this("")
		{
		}
		
		/// <summary>
		/// Marks a class, interface, or a struct as being a representation of a table record.
		/// </summary>
		/// <param name="name">name of the table</param>
		public TableAttribute(string name) : this(name, "")
		{
		}
		
		/// <summary>
		/// Marks a class, interface, or a struct as being a representation of a table record.
		/// </summary>
		/// <param name="name">name of the table</param>
		/// <param name="schema">name of the schema to which this table belongs</param>
		public TableAttribute(string name, string schema) : base()
		{
			this.name = name;
			this.schema = schema;
			this.sequence = "";
		}
		
		/// <summary>
		/// Gets or sets the name of this table.
		/// </summary>
		public string Name
		{
			get { return name; }
			set { name = value; }
		}
		
		/// <summary>
		/// Gets or sets the name of the schema to which this table belongs.
		/// </summary>
		public string Schema
		{
			get { return schema; }
			set { schema = value; }
		}
		
		/// <summary>
		/// Gets or sets the name of the sequence associated with this table.
		/// </summary>
		public string Sequence
		{
			get { return sequence; }
			set { sequence = value; }
		}
		
		/// <summary>
		/// Gets or sets whether mapped fields from the base class (if any)
		/// should be loaded as part of this table model.
		/// </summary>
		public bool Inherit
		{
			get { return inherit; }
			set { inherit = value; }
		}
		
		/// <summary>
		/// Gets or sets whether this table model is readonly.
		/// Only SELECT operation is allowed on readonly tables.
		/// (Useful on types that map to database views.)
		/// </summary>
		public bool ReadOnly
		{
			get { return readOnly; }
			set { readOnly = value; }
		}
	}
}

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140905.1 | Last Updated 8 Oct 2010
Article Copyright 2007 by Sergey Busel
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid