Click here to Skip to main content
15,885,244 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.Production
{
	public class ProductPhoto : SqlTable
	{
		static int InstanceCount = 0;
        
		SqlColumn<int?> _ProductPhotoID;
		SqlBlobColumn _ThumbNailPhoto;
		SqlColumn<string> _ThumbnailPhotoFileName;
		SqlBlobColumn _LargePhoto;
		SqlColumn<string> _LargePhotoFileName;
		SqlColumn<DateTime?> _ModifiedDate;

		public SqlColumn<int?> ProductPhotoID
		{
			get
			{
				return this._ProductPhotoID;
			}
		}
		public SqlBlobColumn ThumbNailPhoto
		{
			get
			{
				return this._ThumbNailPhoto;
			}
		}
		public SqlColumn<string> ThumbnailPhotoFileName
		{
			get
			{
				return this._ThumbnailPhotoFileName;
			}
		}
		public SqlBlobColumn LargePhoto
		{
			get
			{
				return this._LargePhoto;
			}
		}
		public SqlColumn<string> LargePhotoFileName
		{
			get
			{
				return this._LargePhotoFileName;
			}
		}
		public SqlColumn<DateTime?> ModifiedDate
		{
			get
			{
				return this._ModifiedDate;
			}
		}

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

		public ProductPhoto() : base("ProductPhoto", "ProductPhoto", "7", "Production")
		{
			ProductPhoto.InstanceCount++;
			this.instanceName = this.schema_name + "_" + this.name + "_" + ProductPhoto.InstanceCount.ToString();

			_ProductPhotoID = new SqlColumn<int?>(this, null, "ProductPhotoID", 4, 10, "", false, false, true, false);
			_ThumbNailPhoto = new SqlBlobColumn(this, null, "ThumbNailPhoto", "", true);
			_ThumbnailPhotoFileName = new SqlColumn<string>(this, null, "ThumbnailPhotoFileName", 100, 0, "Latin1_General_100_CS_AS", false, true, false, false);
			_LargePhoto = new SqlBlobColumn(this, null, "LargePhoto", "", true);
			_LargePhotoFileName = new SqlColumn<string>(this, null, "LargePhotoFileName", 100, 0, "Latin1_General_100_CS_AS", false, true, false, false);
			_ModifiedDate = new SqlColumn<DateTime?>(this, null, "ModifiedDate", 8, 23, "", false, false, false, false);
		}
		public ProductPhoto(int? id) : this()
		{
		}
		~ProductPhoto()
		{
			ProductPhoto.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