Click here to Skip to main content
15,879,535 members
Articles / Web Development / HTML

Database Object Model

Rate me:
Please Sign up or sign in to vote.
3.00/5 (1 vote)
21 Feb 2012CPOL2 min read 25.9K   693   11  
A Sample ORM project
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using DBOMSqlSharp;

namespace FATIHVAIO.AdventureWorks2008R2.Sales
{
	public class SalesReason : SqlTable
	{
		static int InstanceCount = 0;
        
		SqlColumn<int?> _SalesReasonID;
		SqlColumn<string> _Name;
		SqlColumn<string> _ReasonType;
		SqlColumn<DateTime?> _ModifiedDate;

		public SqlColumn<int?> SalesReasonID
		{
			get
			{
				return this._SalesReasonID;
			}
		}
		public SqlColumn<string> Name
		{
			get
			{
				return this._Name;
			}
		}
		public SqlColumn<string> ReasonType
		{
			get
			{
				return this._ReasonType;
			}
		}
		public SqlColumn<DateTime?> ModifiedDate
		{
			get
			{
				return this._ModifiedDate;
			}
		}

        public override string ConnectionString
		{
			get
			{
				return FATIHVAIOServer.ConnectionString;
			}
		}

		public SalesReason() : base("SalesReason", "SalesReason", "9", "Sales")
		{
			SalesReason.InstanceCount++;
			this.instanceName = this.schema_name + "_" + this.name + "_" + SalesReason.InstanceCount.ToString();

			_SalesReasonID = new SqlColumn<int?>(this, null, "SalesReasonID", 4, 10, "", false, false, true, false);
			_Name = new SqlColumn<string>(this, null, "Name", 100, 0, "Latin1_General_100_CS_AS", false, false, false, false);
			_ReasonType = new SqlColumn<string>(this, null, "ReasonType", 100, 0, "Latin1_General_100_CS_AS", false, false, false, false);
			_ModifiedDate = new SqlColumn<DateTime?>(this, null, "ModifiedDate", 8, 23, "", false, false, false, false);
		}
		public SalesReason(int? id) : this()
		{
		}
		~SalesReason()
		{
			SalesReason.InstanceCount--;
		}
    }
}

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
Turkey Turkey
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions