Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Introduction to Model Driven Development with Sculpture – Part 1

, 3 Sep 2008 CPOL
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.
DialogBox.zip
DialogBox
bin
Debug
Infrastructure.Interface.dll
Infrastructure.Layout.dll
Infrastructure.Library.dll
Infrastructure.Module.dll
Microsoft.Practices.CompositeUI.dll
Microsoft.Practices.CompositeUI.WinForms.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.ObjectBuilder.dll
Module1.dll
Module1.Interface.dll
Shell.exe
Shell.vshost.exe
DialogBox.gpState
Lib
Microsoft.Practices.CompositeUI.dll
Microsoft.Practices.CompositeUI.WinForms.dll
Microsoft.Practices.CompositeUI.WPF.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.EnterpriseLibrary.Data.SqlCe.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.ObjectBuilder.dll
Microsoft.Practices.SmartClient.ConnectionMonitor.dll
Microsoft.Practices.SmartClient.DisconnectedAgent.dll
Microsoft.Practices.SmartClient.EndpointCatalog.dll
Microsoft.Practices.SmartClient.EnterpriseLibrary.dll
Module1
Module1
Constants
obj
Debug
Refactor
TempPE
Properties
Services
Views
DialogView
View1
Module1.Interface
Constants
obj
Debug
Refactor
TempPE
Properties
Services
Source
Infrastructure
Infrastructure.Interface
bin
Debug
Infrastructure.Interface.dll
Microsoft.Practices.CompositeUI.dll
Microsoft.Practices.CompositeUI.WinForms.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.ObjectBuilder.dll
BusinessEntities
Constants
obj
Debug
Refactor
TempPE
Properties
Services
Infrastructure.Layout
obj
Debug
Refactor
TempPE
Properties
Infrastructure.Library
bin
Debug
Infrastructure.Interface.dll
Infrastructure.Library.dll
Microsoft.Practices.CompositeUI.dll
Microsoft.Practices.CompositeUI.WinForms.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.ObjectBuilder.dll
BuilderStrategies
EntityTranslators
EntLib
obj
Debug
Refactor
TempPE
Properties
Services
UI
Web References
Infrastructure.Module
obj
Debug
Refactor
TempPE
Properties
Shell
obj
Debug
Refactor
TempPE
Properties
SculptureExample.zip
WCF+LINQ
SculptureExample
Model
Properties
bin
Debug
obj
Debug
TempPE
MyFirstModel.Sculpture
MyFirstModel.Sculpture.diagram
Entities
Properties
bin
Debug
obj
Debug
TempPE
GeneratedCode
Entities
DataAccess
Properties
Settings.settings
bin
Debug
obj
Debug
TempPE
SQL
GeneratedCode
Repositories
Implementation
Interface
WCFService
Properties
bin
Debug
obj
Debug
TempPE
CustomCode
Translators
Services
GeneratedCode
DataContracts
Services
Contracts
Implementations
WCFHost
App_Data
Properties
bin
obj
Debug
TempPE
WCFHost.csproj.user
Services
CategoriesService.svc
ProductsService.svc
SculptureExample.gpState
NHibernate+ASMX
SculptureExample
Model
Properties
bin
Debug
obj
Debug
TempPE
MyFirstModel.Sculpture
MyFirstModel.Sculpture.diagram
Entities
Properties
bin
Debug
obj
Debug
TempPE
GeneratedCode
Entities
Mappings
DataAccess
Properties
bin
Debug
obj
Debug
TempPE
SQL
GeneratedCode
Repositories
Implementation
Interface
WCFService
Properties
bin
Debug
obj
Debug
TempPE
CustomCode
Translators
Services
GeneratedCode
DataContracts
Services
Contracts
Implementations
WCFHost
App_Data
Properties
bin
obj
Debug
TempPE
build.force
WCFHost.csproj.user
Services
CategoriesService.svc
ProductsService.svc
SculptureExample.gpState
Service
Properties
bin
Debug
obj
Debug
TempPE
CustomCode
Services
Translators
GeneratedCode
DataContracts
Services
Contracts
Implementations
WebService
App_Data
Properties
bin
obj
Debug
TempPE
WebService.csproj.user
Services
Lib
Castle.DynamicProxy.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
SculptureExample_WPFMold.zip
SculptureExample
Model
Properties
bin
Debug
obj
Debug
TempPE
MyFirstModel.Sculpture
MyFirstModel.Sculpture.diagram
SculptureExample.suo
Entities
Properties
bin
Debug
obj
Debug
TempPE
GeneratedCode
Entities
Mappings
DataAccess
Properties
bin
Debug
obj
Debug
TempPE
SQL
GeneratedCode
Repositories
Implementation
Interface
SculptureExample.gpState
Service
Properties
bin
Debug
obj
Debug
TempPE
CustomCode
Services
Translators
GeneratedCode
DataContracts
Services
Contracts
Implementations
Lib
Castle.DynamicProxy.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
WPFApplication
Properties
Settings.settings
bin
Debug
WPFApplication.vshost.exe.manifest
WPFApplication.vshost.exe
obj
Debug
TempPE
Controls
Controls
WPFMold
WPFMold.gpState
WPFMold.suo
WPFMold
Resources
ThemeBitmap.bmp
Properties
Output
WPFMold.Mold
Templates
bin
Microsoft.Data.ConnectionUI.Dialog.dll
Microsoft.Data.ConnectionUI.dll
Microsoft.Practices.RecipeFramework.Extensions.dll
Microsoft.Practices.RepositoryFactory.SchemaDiscovery.dll
Mold3.pdb
MoldBase.dll
MoldBase.pdb
Output
Template
obj
Debug
TempPE
Resource1.Designer.cs.dll
SampleUserControl_cs.cs.dll
SampleUserControl_xaml.cs.dll
SampleUserControl_xaml_cs.cs.dll
Window1_xaml.cs.dll
Window1_xaml_cs.cs.dll
Windows1_cs.cs.dll
Windows1_xaml.cs.dll
Lib
Dawliasoft.Sculpture.Common.dll
Dawliasoft.Sculpture.Dsl.dll
Helpers
//------------------------------------------------------------------------------
// <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 - Products
	/// </summary>
	public partial class Products : EntityBase, 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;
		private Categories _Categories;
 
		#endregion
		
		#region Constractors
		
		public Products()
		{
			OnCreated();
		}
		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;
				
			OnCreated();	
		}		
		///<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 Public Properties
		
		public virtual 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();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual System.Boolean Discontinued
		{
			get
			{
				return _Discontinued;
			}
			set
			{
				if(this._Discontinued != value)
				{
					this.OnDiscontinuedChanging(value);
					this.SendPropertyChanging();
					this._Discontinued = value;
					this.SendPropertyChanged("Discontinued");
					this.OnDiscontinuedChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual System.Int32 ProductID
		{
			get
			{
				return _ProductID;
			}
			set
			{
				if(this._ProductID != value)
				{
					this.OnProductIDChanging(value);
					this.SendPropertyChanging();
					this._ProductID = value;
					this.SendPropertyChanged("ProductID");
					this.OnProductIDChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual System.String ProductName
		{
			get
			{
				return _ProductName;
			}
			set
			{
				if(this._ProductName != value)
				{
					this.OnProductNameChanging(value);
					this.SendPropertyChanging();
					this._ProductName = value;
					this.SendPropertyChanged("ProductName");
					this.OnProductNameChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual System.String QuantityPerUnit
		{
			get
			{
				return _QuantityPerUnit;
			}
			set
			{
				if(this._QuantityPerUnit != value)
				{
					this.OnQuantityPerUnitChanging(value);
					this.SendPropertyChanging();
					this._QuantityPerUnit = value;
					this.SendPropertyChanged("QuantityPerUnit");
					this.OnQuantityPerUnitChanged();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual 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();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual 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();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual 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();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual 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();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual 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();
					if (this._entityState == EntityState.Unchanged)
						this._entityState = EntityState.Changed;
				}
			}
		}
				
		public virtual Categories Categories
		{
			get
			{
				return this._Categories;
			}
			set
			{
				if (this._Categories != value) 
				{
					this.SendPropertyChanging();
					this._Categories = value;
					this.SendPropertyChanged("Categories");
				}
			}
		}
		
		#endregion
		
		#region ICloneable Members
		
		///<summary>
		///  Returns a Typed  Copy of Products Entity 
		///</summary>
		public virtual 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;
			copy.Categories = this.Categories;

            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(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)

Share

About the Author

Ahmed Negm
Chief Technology Officer www.Dawliasoft.com
Egypt Egypt
Program Manager in Sculpture project, Interesting in .NET Model driven development.

| Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 3 Sep 2008
Article Copyright 2008 by Ahmed Negm
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid