Click here to Skip to main content
15,883,901 members
Articles / Desktop Programming / WPF

Introduction to Model Driven Development with Sculpture – Part 1

Rate me:
Please Sign up or sign in to vote.
5.00/5 (23 votes)
3 Sep 2008CPOL15 min read 114.6K   759   124  
This article introduces how to create and manage .NET enterprise applications using your favorite technology (Data Access Application Block, LINQ, NHibernate, ASMX, and WCF) with the Model Driven Development approach by Sculpture.
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by Sculpture Code Generation Engine.
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
//     Generated On : 28/08/2008 06:20:09 م
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Text;	
using System.Collections.Generic;


namespace Entities
{
	/// <summary>
	/// Business Entity Class - Categories
	/// </summary>
	public partial class Categories : EntityBase, ICloneable
	{
	
		#region Private Properties
		
		private System.Int32 _CategoryID;
		private System.String _CategoryName;
		private System.String _Description;
		private System.Byte[] _Picture;
		private IList<Products> _Productss;
 
		#endregion
		
		#region Constractors
		
		public Categories()
		{
			OnCreated();
		}
		public Categories(System.Int32 categoryid, System.String categoryname, System.String description, System.Byte[] picture)
		{
			this.CategoryID = categoryid;
			this.CategoryName = categoryname;
			this.Description = description;
			this.Picture = picture;
				
			OnCreated();	
		}		
		///<summary>
		/// A simple factory method to create a new Categories instance.
		///</summary>
		public static Categories CreateCategories(System.Int32 categoryid, System.String categoryname, System.String description, System.Byte[] picture)
		{
			Categories newCategories = new Categories();
			newCategories.CategoryID = categoryid;
			newCategories.CategoryName = categoryname;
			newCategories.Description = description;
			newCategories.Picture = picture;
			return newCategories;			
		}
		
		#endregion
		
		#region Public Properties
		
		public virtual System.Int32 CategoryID
		{
			get
			{
				return _CategoryID;
			}
			set
			{
				if(this._CategoryID != value)
				{
					this.OnCategoryIDChanging(value);
					this.SendPropertyChanging();
					this._CategoryID = value;
					this.SendPropertyChanged("CategoryID");
					this.OnCategoryIDChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual System.String CategoryName
		{
			get
			{
				return _CategoryName;
			}
			set
			{
				if(this._CategoryName != value)
				{
					this.OnCategoryNameChanging(value);
					this.SendPropertyChanging();
					this._CategoryName = value;
					this.SendPropertyChanged("CategoryName");
					this.OnCategoryNameChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual System.String Description
		{
			get
			{
				return _Description;
			}
			set
			{
				if(this._Description != value)
				{
					this.OnDescriptionChanging(value);
					this.SendPropertyChanging();
					this._Description = value;
					this.SendPropertyChanged("Description");
					this.OnDescriptionChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual System.Byte[] Picture
		{
			get
			{
				return _Picture;
			}
			set
			{
				if(this._Picture != value)
				{
					this.OnPictureChanging(value);
					this.SendPropertyChanging();
					this._Picture = value;
					this.SendPropertyChanged("Picture");
					this.OnPictureChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual IList<Products> Productss
		{
			get
			{
				if (this._Productss == null)
                    return new List<Products>();
                return this._Productss;
			}
			set
			{
				this._Productss = value;
			}
		}
		
		#endregion
		
		#region ICloneable Members
		
		///<summary>
		///  Returns a Typed  Copy of Categories Entity 
		///</summary>
		public virtual Categories Copy()
		{
			Categories copy = new Categories();

			copy.CategoryID = this.CategoryID;
			copy.CategoryName = this.CategoryName;
			copy.Description = this.Description;
			copy.Picture = this.Picture;
			copy.Productss = this.Productss;

            return copy;
		}
		
		///<summary>
		/// ICloneable.Clone() Member, returns Copy of this entity.
		///</summary>
		public virtual object Clone()
		{
			return this.Copy();
		}
		
		#endregion
		
		#region Check Equality
		
		public virtual bool Equals(Categories obj)
		{
            if (obj.CategoryID != this.CategoryID)
				return false;
            if (obj.CategoryName != this.CategoryName)
				return false;
            if (obj.Description != this.Description)
				return false;
            if (obj.Picture != this.Picture)
				return false;

			return true;
		}
		
		#endregion
		
		#region To String
			
		public override string ToString()
		{
			StringBuilder _string = new StringBuilder();
			
			_string.AppendFormat("<CategoryID>{0}</CategoryID>{1}", this.CategoryID.ToString(), System.Environment.NewLine);
			
			if(this.CategoryName != null)
			_string.AppendFormat("<CategoryName>{0}</CategoryName>{1}", this.CategoryName.ToString(), System.Environment.NewLine);
			
			if(this.Description != null)
			_string.AppendFormat("<Description>{0}</Description>{1}", this.Description.ToString(), System.Environment.NewLine);
			
			if(this.Picture != null)
			_string.AppendFormat("<Picture>{0}</Picture>{1}", this.Picture.ToString(), System.Environment.NewLine);
			
			return _string.ToString();
		}
			
		#endregion
		
		#region Extensibility Method Definitions
		
		partial void OnCreated();
		partial void OnCategoryIDChanging(System.Int32 value);
		partial void OnCategoryIDChanged();
		partial void OnCategoryNameChanging(System.String value);
		partial void OnCategoryNameChanged();
		partial void OnDescriptionChanging(System.String value);
		partial void OnDescriptionChanged();
		partial void OnPictureChanging(System.Byte[] value);
		partial void OnPictureChanged();
		
		#endregion
		
	}
}

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
Chief Technology Officer www.Dawliasoft.com
Egypt Egypt
Program Manager in Sculpture project, Interesting in .NET Model driven development.

Comments and Discussions