Click here to Skip to main content
15,861,172 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 113.5K   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:11 م
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Text;

namespace Service
{
	/// <summary>
	/// Data Contract Class - Products
	/// </summary>
	public partial class Products : DataContractBase, ICloneable
	{

		#region Private Properties
		
		private Nullable<System.Int32> _CategoryID;
		private System.Boolean _Discontinued;
		private System.Int32 _ProductID;
		private System.String _ProductName;
		private System.String _QuantityPerUnit;
		private Nullable<System.Int16> _ReorderLevel;
		private Nullable<System.Int32> _SupplierID;
		private Nullable<System.Decimal> _UnitPrice;
		private Nullable<System.Int16> _UnitsInStock;
		private Nullable<System.Int16> _UnitsOnOrder;
		
		#endregion
		
		#region Constractors
		
		public Products()
		{
		}
		
		public Products(Nullable<System.Int32> categoryid, System.Boolean discontinued, System.Int32 productid, System.String productname, System.String quantityperunit, Nullable<System.Int16> reorderlevel, Nullable<System.Int32> supplierid, Nullable<System.Decimal> unitprice, Nullable<System.Int16> unitsinstock, Nullable<System.Int16> unitsonorder)
		{
			this.CategoryID = categoryid;
			this.Discontinued = discontinued;
			this.ProductID = productid;
			this.ProductName = productname;
			this.QuantityPerUnit = quantityperunit;
			this.ReorderLevel = reorderlevel;
			this.SupplierID = supplierid;
			this.UnitPrice = unitprice;
			this.UnitsInStock = unitsinstock;
			this.UnitsOnOrder = unitsonorder;
					
		}		

		///<summary>
		/// A simple factory method to create a new Products instance.
		///</summary>
		public static Products CreateProducts(Nullable<System.Int32> categoryid, System.Boolean discontinued, System.Int32 productid, System.String productname, System.String quantityperunit, Nullable<System.Int16> reorderlevel, Nullable<System.Int32> supplierid, Nullable<System.Decimal> unitprice, Nullable<System.Int16> unitsinstock, Nullable<System.Int16> unitsonorder)
		{
			Products newProducts = new Products();
			newProducts.CategoryID = categoryid;
			newProducts.Discontinued = discontinued;
			newProducts.ProductID = productid;
			newProducts.ProductName = productname;
			newProducts.QuantityPerUnit = quantityperunit;
			newProducts.ReorderLevel = reorderlevel;
			newProducts.SupplierID = supplierid;
			newProducts.UnitPrice = unitprice;
			newProducts.UnitsInStock = unitsinstock;
			newProducts.UnitsOnOrder = unitsonorder;
			return newProducts;			
		}
		
		#endregion
		
		#region Puplic Properties
		
		public Nullable<System.Int32> CategoryID
		{
			get
			{
				return _CategoryID;
			}
			set
			{
				if(this._CategoryID != value)
				{
					this.OnCategoryIDChanging(value);
					this.SendPropertyChanging();
					this._CategoryID = value;
					this.SendPropertyChanged("CategoryID");
					this.OnCategoryIDChanged();
				}
			}
		}
				
		public System.Boolean Discontinued
		{
			get
			{
				return _Discontinued;
			}
			set
			{
				if(this._Discontinued != value)
				{
					this.OnDiscontinuedChanging(value);
					this.SendPropertyChanging();
					this._Discontinued = value;
					this.SendPropertyChanged("Discontinued");
					this.OnDiscontinuedChanged();
				}
			}
		}
				
		public System.Int32 ProductID
		{
			get
			{
				return _ProductID;
			}
			set
			{
				if(this._ProductID != value)
				{
					this.OnProductIDChanging(value);
					this.SendPropertyChanging();
					this._ProductID = value;
					this.SendPropertyChanged("ProductID");
					this.OnProductIDChanged();
				}
			}
		}
				
		public System.String ProductName
		{
			get
			{
				return _ProductName;
			}
			set
			{
				if(this._ProductName != value)
				{
					this.OnProductNameChanging(value);
					this.SendPropertyChanging();
					this._ProductName = value;
					this.SendPropertyChanged("ProductName");
					this.OnProductNameChanged();
				}
			}
		}
				
		public System.String QuantityPerUnit
		{
			get
			{
				return _QuantityPerUnit;
			}
			set
			{
				if(this._QuantityPerUnit != value)
				{
					this.OnQuantityPerUnitChanging(value);
					this.SendPropertyChanging();
					this._QuantityPerUnit = value;
					this.SendPropertyChanged("QuantityPerUnit");
					this.OnQuantityPerUnitChanged();
				}
			}
		}
				
		public Nullable<System.Int16> ReorderLevel
		{
			get
			{
				return _ReorderLevel;
			}
			set
			{
				if(this._ReorderLevel != value)
				{
					this.OnReorderLevelChanging(value);
					this.SendPropertyChanging();
					this._ReorderLevel = value;
					this.SendPropertyChanged("ReorderLevel");
					this.OnReorderLevelChanged();
				}
			}
		}
				
		public Nullable<System.Int32> SupplierID
		{
			get
			{
				return _SupplierID;
			}
			set
			{
				if(this._SupplierID != value)
				{
					this.OnSupplierIDChanging(value);
					this.SendPropertyChanging();
					this._SupplierID = value;
					this.SendPropertyChanged("SupplierID");
					this.OnSupplierIDChanged();
				}
			}
		}
				
		public Nullable<System.Decimal> UnitPrice
		{
			get
			{
				return _UnitPrice;
			}
			set
			{
				if(this._UnitPrice != value)
				{
					this.OnUnitPriceChanging(value);
					this.SendPropertyChanging();
					this._UnitPrice = value;
					this.SendPropertyChanged("UnitPrice");
					this.OnUnitPriceChanged();
				}
			}
		}
				
		public Nullable<System.Int16> UnitsInStock
		{
			get
			{
				return _UnitsInStock;
			}
			set
			{
				if(this._UnitsInStock != value)
				{
					this.OnUnitsInStockChanging(value);
					this.SendPropertyChanging();
					this._UnitsInStock = value;
					this.SendPropertyChanged("UnitsInStock");
					this.OnUnitsInStockChanged();
				}
			}
		}
				
		public Nullable<System.Int16> UnitsOnOrder
		{
			get
			{
				return _UnitsOnOrder;
			}
			set
			{
				if(this._UnitsOnOrder != value)
				{
					this.OnUnitsOnOrderChanging(value);
					this.SendPropertyChanging();
					this._UnitsOnOrder = value;
					this.SendPropertyChanged("UnitsOnOrder");
					this.OnUnitsOnOrderChanged();
				}
			}
		}
				

		#endregion
		
		#region ICloneable Members
		
		///<summary>
		///  Returns a Typed  Copy of Products DataContract 
		///</summary>
		public Products Copy()
		{
			Products copy = new Products();

			copy.CategoryID = this.CategoryID;
			copy.Discontinued = this.Discontinued;
			copy.ProductID = this.ProductID;
			copy.ProductName = this.ProductName;
			copy.QuantityPerUnit = this.QuantityPerUnit;
			copy.ReorderLevel = this.ReorderLevel;
			copy.SupplierID = this.SupplierID;
			copy.UnitPrice = this.UnitPrice;
			copy.UnitsInStock = this.UnitsInStock;
			copy.UnitsOnOrder = this.UnitsOnOrder;

            return copy;
		}
		
		///<summary>
		/// ICloneable.Clone() Member, returns Copy of this Data Contract.
		///</summary>
		public object Clone()
		{
			return this.Copy();
		}
		
		#endregion
		
		#region Check Equality
		
		public bool Equals(Products obj)
		{
            if (obj.CategoryID != this.CategoryID)
				return false;
            if (obj.Discontinued != this.Discontinued)
				return false;
            if (obj.ProductID != this.ProductID)
				return false;
            if (obj.ProductName != this.ProductName)
				return false;
            if (obj.QuantityPerUnit != this.QuantityPerUnit)
				return false;
            if (obj.ReorderLevel != this.ReorderLevel)
				return false;
            if (obj.SupplierID != this.SupplierID)
				return false;
            if (obj.UnitPrice != this.UnitPrice)
				return false;
            if (obj.UnitsInStock != this.UnitsInStock)
				return false;
            if (obj.UnitsOnOrder != this.UnitsOnOrder)
				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);
			
			_string.AppendFormat("<Discontinued>{0}</Discontinued>{1}", this.Discontinued.ToString(), System.Environment.NewLine);
			
			_string.AppendFormat("<ProductID>{0}</ProductID>{1}", this.ProductID.ToString(), System.Environment.NewLine);
			
			if(this.ProductName != null)
			_string.AppendFormat("<ProductName>{0}</ProductName>{1}", this.ProductName.ToString(), System.Environment.NewLine);
			
			if(this.QuantityPerUnit != null)
			_string.AppendFormat("<QuantityPerUnit>{0}</QuantityPerUnit>{1}", this.QuantityPerUnit.ToString(), System.Environment.NewLine);
			
			_string.AppendFormat("<ReorderLevel>{0}</ReorderLevel>{1}", this.ReorderLevel.ToString(), System.Environment.NewLine);
			
			_string.AppendFormat("<SupplierID>{0}</SupplierID>{1}", this.SupplierID.ToString(), System.Environment.NewLine);
			
			_string.AppendFormat("<UnitPrice>{0}</UnitPrice>{1}", this.UnitPrice.ToString(), System.Environment.NewLine);
			
			_string.AppendFormat("<UnitsInStock>{0}</UnitsInStock>{1}", this.UnitsInStock.ToString(), System.Environment.NewLine);
			
			_string.AppendFormat("<UnitsOnOrder>{0}</UnitsOnOrder>{1}", this.UnitsOnOrder.ToString(), System.Environment.NewLine);
			
			return _string.ToString();
		}
			
		#endregion
		
		#region Extensibility Method Definitions
		
		partial void OnCreated();
		partial void OnCategoryIDChanging(Nullable<System.Int32> value);
		partial void OnCategoryIDChanged();
		partial void OnDiscontinuedChanging(System.Boolean value);
		partial void OnDiscontinuedChanged();
		partial void OnProductIDChanging(System.Int32 value);
		partial void OnProductIDChanged();
		partial void OnProductNameChanging(System.String value);
		partial void OnProductNameChanged();
		partial void OnQuantityPerUnitChanging(System.String value);
		partial void OnQuantityPerUnitChanged();
		partial void OnReorderLevelChanging(Nullable<System.Int16> value);
		partial void OnReorderLevelChanged();
		partial void OnSupplierIDChanging(Nullable<System.Int32> value);
		partial void OnSupplierIDChanged();
		partial void OnUnitPriceChanging(Nullable<System.Decimal> value);
		partial void OnUnitPriceChanged();
		partial void OnUnitsInStockChanging(Nullable<System.Int16> value);
		partial void OnUnitsInStockChanged();
		partial void OnUnitsOnOrderChanging(Nullable<System.Int16> value);
		partial void OnUnitsOnOrderChanged();
		
		#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