Click here to Skip to main content
11,570,750 members (48,025 online)
Click here to Skip to main content
Articles » Database » Database » SQL Server » Downloads
Add your own
alternative version

Database-Driven Business Layer Templates

, 22 Jan 2008 CPOL 35.2K 367 106
A introduction to the flexibilities provided by the use of SQL extended properties in business layer code templates.
customesn.zip
NorthwindExtendedProperties.csv
CustomESNBusinessLayer
Created
Customers
Employees
Orders
Products
CustomESNBusinessLayer.csproj.user
Generated
Customers
Employees
Orders
Products
Properties
Templates
Custom
EntitySpaces_C#_Custom_Collection.csgen
EntitySpaces_C#_Custom_Entity.csgen
EntitySpaces_C#_Custom_Query.csgen
EntitySpaces_C#_Custom_Master.csgen
EntitySpaces_C#_Generated_Master.csgen
Generated
EntitySpaces_C#_Collection.csgen
EntitySpaces_C#_Entity.csgen
EntitySpaces_C#_esCollection.csgen
EntitySpaces_C#_esEntity.csgen
EntitySpaces_C#_esQuery.csgen
EntitySpaces_C#_Hierarchical.csgen
EntitySpaces_C#_Metadata.csgen
EntitySpaces_C#_MetadataMap.csgen
EntitySpaces_C#_Query.csgen
/*
===============================================================================
                     EntitySpaces(TM) by EntitySpaces, LLC
                 A New 2.0 Architecture for the .NET Framework
                          http://www.entityspaces.net
===============================================================================
                       EntitySpaces Version # 2007.1.1024.0
                       MyGeneration Version # 1.2.0.2
                           12/19/2007 2:30:01 PM
-------------------------------------------------------------------------------
*/


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Data;
using System.ComponentModel;
using System.Xml.Serialization;


using EntitySpaces.Interfaces;
using EntitySpaces.Core;



namespace DAK.CustomESN.BusinessLayer
{
	
	[Serializable]
	[GeneratedCode]
	abstract public class esInvoiceCollection : esEntityCollection, INotifyCollectionChanged
	{
		public esInvoiceCollection()
		{

		}
		
		public event NotifyCollectionChangedEventHandler CollectionChanged;
		
		protected override string GetCollectionName()
		{
			return "InvoiceCollection";
		}
		
		#region Query Logic
		protected void InitQuery(esInvoiceQuery query)
		{
			query.OnLoadEvent += new esDynamicQuery.QueryLoadedDelegate(OnQueryLoaded);
			query.es.Connection = ((IEntityCollection)this).Connection;
		}

		protected bool OnQueryLoaded(DataTable table)
		{
			this.PopulateCollection(table);
			return (this.RowCount > 0) ? true : false;
		}
		#endregion
		
		virtual public Invoice DetachEntity(Invoice entity)
		{
			return base.DetachEntity(entity) as Invoice;
		}
		
		virtual public Invoice AttachEntity(Invoice entity)
		{
			return base.AttachEntity(entity) as Invoice;
		}
		
		virtual public void Combine(InvoiceCollection collection)
		{
            base.Combine(collection);
        }
		
        new public Invoice this[int index]
        {
            get
            {
                return base[index] as Invoice;
            }
        }		
	}
	


	[Serializable]
	[GeneratedCode]
	abstract public class esInvoice : esEntity, INotifyPropertyChanged
	{
		virtual protected esInvoiceQuery GetDynamicQuery()
		{
			return null;
		}
		
		public esInvoice()
		{
		}
	
		public esInvoice(DataRow row)
			: base(row)
		{
		}
		
		#region LoadByPrimaryKey
		
		#endregion
		
        #region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;

		protected void OnPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}

        #endregion		
		
		#region Properties
		
        public override void SetProperties(IDictionary values)
        {
            foreach (string propertyName in values.Keys)
            {
                this.SetProperty(propertyName, values[propertyName]);
            }
        }

		public override void SetProperty(string name, object value)
		{
			if(this.Row == null) this.AddNew();
			
			esColumnMetadata col = this.Meta.Columns.FindByPropertyName(name);
			if (col != null)
			{
				if(value == null || value.GetType().ToString() == "System.String")
				{				
					// Use the strongly typed property
					switch (name)
					{							
						case "ShipName": this.str.ShipName = (string)value; break;							
						case "ShipAddress": this.str.ShipAddress = (string)value; break;							
						case "ShipCity": this.str.ShipCity = (string)value; break;							
						case "ShipRegion": this.str.ShipRegion = (string)value; break;							
						case "ShipPostalCode": this.str.ShipPostalCode = (string)value; break;							
						case "ShipCountry": this.str.ShipCountry = (string)value; break;							
						case "CustomerID": this.str.CustomerID = (string)value; break;							
						case "CustomerName": this.str.CustomerName = (string)value; break;							
						case "Address": this.str.Address = (string)value; break;							
						case "City": this.str.City = (string)value; break;							
						case "Region": this.str.Region = (string)value; break;							
						case "PostalCode": this.str.PostalCode = (string)value; break;							
						case "Country": this.str.Country = (string)value; break;							
						case "Salesperson": this.str.Salesperson = (string)value; break;							
						case "OrderID": this.str.OrderID = (string)value; break;							
						case "OrderDate": this.str.OrderDate = (string)value; break;							
						case "RequiredDate": this.str.RequiredDate = (string)value; break;							
						case "ShippedDate": this.str.ShippedDate = (string)value; break;							
						case "ShipperName": this.str.ShipperName = (string)value; break;							
						case "ProductID": this.str.ProductID = (string)value; break;							
						case "ProductName": this.str.ProductName = (string)value; break;							
						case "UnitPrice": this.str.UnitPrice = (string)value; break;							
						case "Quantity": this.str.Quantity = (string)value; break;							
						case "Discount": this.str.Discount = (string)value; break;							
						case "ExtendedPrice": this.str.ExtendedPrice = (string)value; break;							
						case "Freight": this.str.Freight = (string)value; break;
					}
				}
				else
				{
					switch (name)
					{	
						case "OrderID":
						
							if (value == null || value.GetType().ToString() == "System.Int32")
								this.OrderID = (System.Int32?)value;
							break;
						
						case "OrderDate":
						
							if (value == null || value.GetType().ToString() == "System.DateTime")
								this.OrderDate = (System.DateTime?)value;
							break;
						
						case "RequiredDate":
						
							if (value == null || value.GetType().ToString() == "System.DateTime")
								this.RequiredDate = (System.DateTime?)value;
							break;
						
						case "ShippedDate":
						
							if (value == null || value.GetType().ToString() == "System.DateTime")
								this.ShippedDate = (System.DateTime?)value;
							break;
						
						case "ProductID":
						
							if (value == null || value.GetType().ToString() == "System.Int32")
								this.ProductID = (System.Int32?)value;
							break;
						
						case "UnitPrice":
						
							if (value == null || value.GetType().ToString() == "System.Decimal")
								this.UnitPrice = (System.Decimal?)value;
							break;
						
						case "Quantity":
						
							if (value == null || value.GetType().ToString() == "System.Int16")
								this.Quantity = (System.Int16?)value;
							break;
						
						case "Discount":
						
							if (value == null || value.GetType().ToString() == "System.Single")
								this.Discount = (System.Single?)value;
							break;
						
						case "ExtendedPrice":
						
							if (value == null || value.GetType().ToString() == "System.Decimal")
								this.ExtendedPrice = (System.Decimal?)value;
							break;
						
						case "Freight":
						
							if (value == null || value.GetType().ToString() == "System.Decimal")
								this.Freight = (System.Decimal?)value;
							break;
						
					
						default:
							break;
					}
				}
			}
			else if(this.Row.Table.Columns.Contains(name))
			{
				this.Row[name] = value;
			}
			else
			{
				throw new Exception("SetProperty Error: '" + name + "' not found");
			}
		}
		
		
		/// <summary>
		/// Maps to Invoices.ShipName
		/// </summary>
		virtual public System.String ShipName
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ShipName);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ShipName, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShipName);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShipName));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ShipAddress
		/// </summary>
		virtual public System.String ShipAddress
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ShipAddress);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ShipAddress, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShipAddress);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShipAddress));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ShipCity
		/// </summary>
		virtual public System.String ShipCity
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ShipCity);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ShipCity, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShipCity);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShipCity));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ShipRegion
		/// </summary>
		virtual public System.String ShipRegion
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ShipRegion);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ShipRegion, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShipRegion);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShipRegion));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ShipPostalCode
		/// </summary>
		virtual public System.String ShipPostalCode
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ShipPostalCode);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ShipPostalCode, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShipPostalCode);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShipPostalCode));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ShipCountry
		/// </summary>
		virtual public System.String ShipCountry
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ShipCountry);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ShipCountry, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShipCountry);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShipCountry));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.CustomerID
		/// </summary>
		virtual public System.String CustomerID
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.CustomerID);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.CustomerID, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.CustomerID);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.CustomerID));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.CustomerName
		/// </summary>
		virtual public System.String CustomerName
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.CustomerName);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.CustomerName, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.CustomerName);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.CustomerName));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.Address
		/// </summary>
		virtual public System.String Address
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.Address);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.Address, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.Address);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.Address));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.City
		/// </summary>
		virtual public System.String City
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.City);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.City, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.City);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.City));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.Region
		/// </summary>
		virtual public System.String Region
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.Region);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.Region, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.Region);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.Region));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.PostalCode
		/// </summary>
		virtual public System.String PostalCode
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.PostalCode);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.PostalCode, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.PostalCode);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.PostalCode));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.Country
		/// </summary>
		virtual public System.String Country
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.Country);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.Country, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.Country);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.Country));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.Salesperson
		/// </summary>
		virtual public System.String Salesperson
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.Salesperson);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.Salesperson, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.Salesperson);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.Salesperson));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.OrderID
		/// </summary>
		virtual public System.Int32? OrderID
		{
			get
			{
				return base.GetSystemInt32(InvoiceMetadata.ColumnNames.OrderID);
			}
			
			set
			{
				if(base.SetSystemInt32(InvoiceMetadata.ColumnNames.OrderID, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.OrderID);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.OrderID));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.OrderDate
		/// </summary>
		virtual public System.DateTime? OrderDate
		{
			get
			{
				return base.GetSystemDateTime(InvoiceMetadata.ColumnNames.OrderDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(InvoiceMetadata.ColumnNames.OrderDate, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.OrderDate);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.OrderDate));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.RequiredDate
		/// </summary>
		virtual public System.DateTime? RequiredDate
		{
			get
			{
				return base.GetSystemDateTime(InvoiceMetadata.ColumnNames.RequiredDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(InvoiceMetadata.ColumnNames.RequiredDate, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.RequiredDate);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.RequiredDate));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ShippedDate
		/// </summary>
		virtual public System.DateTime? ShippedDate
		{
			get
			{
				return base.GetSystemDateTime(InvoiceMetadata.ColumnNames.ShippedDate);
			}
			
			set
			{
				if(base.SetSystemDateTime(InvoiceMetadata.ColumnNames.ShippedDate, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShippedDate);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShippedDate));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ShipperName
		/// </summary>
		virtual public System.String ShipperName
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ShipperName);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ShipperName, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ShipperName);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ShipperName));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ProductID
		/// </summary>
		virtual public System.Int32? ProductID
		{
			get
			{
				return base.GetSystemInt32(InvoiceMetadata.ColumnNames.ProductID);
			}
			
			set
			{
				if(base.SetSystemInt32(InvoiceMetadata.ColumnNames.ProductID, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ProductID);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ProductID));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ProductName
		/// </summary>
		virtual public System.String ProductName
		{
			get
			{
				return base.GetSystemString(InvoiceMetadata.ColumnNames.ProductName);
			}
			
			set
			{
				if(base.SetSystemString(InvoiceMetadata.ColumnNames.ProductName, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ProductName);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ProductName));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.UnitPrice
		/// </summary>
		virtual public System.Decimal? UnitPrice
		{
			get
			{
				return base.GetSystemDecimal(InvoiceMetadata.ColumnNames.UnitPrice);
			}
			
			set
			{
				if(base.SetSystemDecimal(InvoiceMetadata.ColumnNames.UnitPrice, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.UnitPrice);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.UnitPrice));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.Quantity
		/// </summary>
		virtual public System.Int16? Quantity
		{
			get
			{
				return base.GetSystemInt16(InvoiceMetadata.ColumnNames.Quantity);
			}
			
			set
			{
				if(base.SetSystemInt16(InvoiceMetadata.ColumnNames.Quantity, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.Quantity);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.Quantity));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.Discount
		/// </summary>
		virtual public System.Single? Discount
		{
			get
			{
				return base.GetSystemSingle(InvoiceMetadata.ColumnNames.Discount);
			}
			
			set
			{
				if(base.SetSystemSingle(InvoiceMetadata.ColumnNames.Discount, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.Discount);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.Discount));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.ExtendedPrice
		/// </summary>
		virtual public System.Decimal? ExtendedPrice
		{
			get
			{
				return base.GetSystemDecimal(InvoiceMetadata.ColumnNames.ExtendedPrice);
			}
			
			set
			{
				if(base.SetSystemDecimal(InvoiceMetadata.ColumnNames.ExtendedPrice, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.ExtendedPrice);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.ExtendedPrice));
					}
				}
			}
		}
		
		/// <summary>
		/// Maps to Invoices.Freight
		/// </summary>
		virtual public System.Decimal? Freight
		{
			get
			{
				return base.GetSystemDecimal(InvoiceMetadata.ColumnNames.Freight);
			}
			
			set
			{
				if(base.SetSystemDecimal(InvoiceMetadata.ColumnNames.Freight, value))
				{
					
					this.MarkFieldAsModified(InvoiceMetadata.ColumnNames.Freight);
					if (PropertyChanged != null)
					{
						PropertyChanged(this, new PropertyChangedEventArgs(InvoiceMetadata.PropertyNames.Freight));
					}
				}
			}
		}
		
		#endregion	

		#region String Properties

		[BrowsableAttribute( false )]		
		public esStrings str
		{
			get
			{
				if (esstrings == null)
				{
					esstrings = new esStrings(this);
				}
				return esstrings;
			}
		}


		[Serializable]
		[GeneratedCode]
		sealed public class esStrings
		{
			public esStrings(esInvoice entity)
			{
				this.entity = entity;
			}
			
	
			public System.String ShipName
			{
				get
				{
					System.String data = entity.ShipName;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShipName = null;
					else entity.ShipName = Convert.ToString(value);
				}
			}
		  	
			public System.String ShipAddress
			{
				get
				{
					System.String data = entity.ShipAddress;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShipAddress = null;
					else entity.ShipAddress = Convert.ToString(value);
				}
			}
		  	
			public System.String ShipCity
			{
				get
				{
					System.String data = entity.ShipCity;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShipCity = null;
					else entity.ShipCity = Convert.ToString(value);
				}
			}
		  	
			public System.String ShipRegion
			{
				get
				{
					System.String data = entity.ShipRegion;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShipRegion = null;
					else entity.ShipRegion = Convert.ToString(value);
				}
			}
		  	
			public System.String ShipPostalCode
			{
				get
				{
					System.String data = entity.ShipPostalCode;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShipPostalCode = null;
					else entity.ShipPostalCode = Convert.ToString(value);
				}
			}
		  	
			public System.String ShipCountry
			{
				get
				{
					System.String data = entity.ShipCountry;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShipCountry = null;
					else entity.ShipCountry = Convert.ToString(value);
				}
			}
		  	
			public System.String CustomerID
			{
				get
				{
					System.String data = entity.CustomerID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CustomerID = null;
					else entity.CustomerID = Convert.ToString(value);
				}
			}
		  	
			public System.String CustomerName
			{
				get
				{
					System.String data = entity.CustomerName;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.CustomerName = null;
					else entity.CustomerName = Convert.ToString(value);
				}
			}
		  	
			public System.String Address
			{
				get
				{
					System.String data = entity.Address;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Address = null;
					else entity.Address = Convert.ToString(value);
				}
			}
		  	
			public System.String City
			{
				get
				{
					System.String data = entity.City;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.City = null;
					else entity.City = Convert.ToString(value);
				}
			}
		  	
			public System.String Region
			{
				get
				{
					System.String data = entity.Region;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Region = null;
					else entity.Region = Convert.ToString(value);
				}
			}
		  	
			public System.String PostalCode
			{
				get
				{
					System.String data = entity.PostalCode;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.PostalCode = null;
					else entity.PostalCode = Convert.ToString(value);
				}
			}
		  	
			public System.String Country
			{
				get
				{
					System.String data = entity.Country;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Country = null;
					else entity.Country = Convert.ToString(value);
				}
			}
		  	
			public System.String Salesperson
			{
				get
				{
					System.String data = entity.Salesperson;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Salesperson = null;
					else entity.Salesperson = Convert.ToString(value);
				}
			}
		  	
			public System.String OrderID
			{
				get
				{
					System.Int32? data = entity.OrderID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.OrderID = null;
					else entity.OrderID = Convert.ToInt32(value);
				}
			}
		  	
			public System.String OrderDate
			{
				get
				{
					System.DateTime? data = entity.OrderDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.OrderDate = null;
					else entity.OrderDate = Convert.ToDateTime(value);
				}
			}
		  	
			public System.String RequiredDate
			{
				get
				{
					System.DateTime? data = entity.RequiredDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.RequiredDate = null;
					else entity.RequiredDate = Convert.ToDateTime(value);
				}
			}
		  	
			public System.String ShippedDate
			{
				get
				{
					System.DateTime? data = entity.ShippedDate;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShippedDate = null;
					else entity.ShippedDate = Convert.ToDateTime(value);
				}
			}
		  	
			public System.String ShipperName
			{
				get
				{
					System.String data = entity.ShipperName;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ShipperName = null;
					else entity.ShipperName = Convert.ToString(value);
				}
			}
		  	
			public System.String ProductID
			{
				get
				{
					System.Int32? data = entity.ProductID;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ProductID = null;
					else entity.ProductID = Convert.ToInt32(value);
				}
			}
		  	
			public System.String ProductName
			{
				get
				{
					System.String data = entity.ProductName;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ProductName = null;
					else entity.ProductName = Convert.ToString(value);
				}
			}
		  	
			public System.String UnitPrice
			{
				get
				{
					System.Decimal? data = entity.UnitPrice;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.UnitPrice = null;
					else entity.UnitPrice = Convert.ToDecimal(value);
				}
			}
		  	
			public System.String Quantity
			{
				get
				{
					System.Int16? data = entity.Quantity;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Quantity = null;
					else entity.Quantity = Convert.ToInt16(value);
				}
			}
		  	
			public System.String Discount
			{
				get
				{
					System.Single? data = entity.Discount;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Discount = null;
					else entity.Discount = Convert.ToSingle(value);
				}
			}
		  	
			public System.String ExtendedPrice
			{
				get
				{
					System.Decimal? data = entity.ExtendedPrice;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.ExtendedPrice = null;
					else entity.ExtendedPrice = Convert.ToDecimal(value);
				}
			}
		  	
			public System.String Freight
			{
				get
				{
					System.Decimal? data = entity.Freight;
					return (data == null) ? String.Empty : Convert.ToString(data);
				}

				set
				{
					if (value == null || value.Length == 0) entity.Freight = null;
					else entity.Freight = Convert.ToDecimal(value);
				}
			}
		  

			private esInvoice entity;
		}
		#endregion

		#region Query Logic
		protected void InitQuery(esInvoiceQuery query)
		{
			query.OnLoadEvent += new esDynamicQuery.QueryLoadedDelegate(OnQueryLoaded);
			query.es.Connection = ((IEntity)this).Connection;
		}

		protected bool OnQueryLoaded(DataTable table)
		{
			bool dataFound = this.PopulateEntity(table);

			if (this.RowCount > 1)
			{
				throw new Exception("esInvoice can only hold one record of data");
			}

			return dataFound;
		}
		#endregion
		
		[NonSerialized]
		private esStrings esstrings;
	}



	[Serializable]
	[GeneratedCode]
	abstract public class esInvoiceQuery : esDynamicQuery
	{
		override protected IMetadata Meta
		{
			get
			{
				return InvoiceMetadata.Meta();
			}
		}	
		

		public esQueryItem ShipName
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShipName);
			}
		} 
		
		public esQueryItem ShipAddress
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShipAddress);
			}
		} 
		
		public esQueryItem ShipCity
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShipCity);
			}
		} 
		
		public esQueryItem ShipRegion
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShipRegion);
			}
		} 
		
		public esQueryItem ShipPostalCode
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShipPostalCode);
			}
		} 
		
		public esQueryItem ShipCountry
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShipCountry);
			}
		} 
		
		public esQueryItem CustomerID
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.CustomerID);
			}
		} 
		
		public esQueryItem CustomerName
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.CustomerName);
			}
		} 
		
		public esQueryItem Address
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.Address);
			}
		} 
		
		public esQueryItem City
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.City);
			}
		} 
		
		public esQueryItem Region
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.Region);
			}
		} 
		
		public esQueryItem PostalCode
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.PostalCode);
			}
		} 
		
		public esQueryItem Country
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.Country);
			}
		} 
		
		public esQueryItem Salesperson
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.Salesperson);
			}
		} 
		
		public esQueryItem OrderID
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.OrderID);
			}
		} 
		
		public esQueryItem OrderDate
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.OrderDate);
			}
		} 
		
		public esQueryItem RequiredDate
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.RequiredDate);
			}
		} 
		
		public esQueryItem ShippedDate
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShippedDate);
			}
		} 
		
		public esQueryItem ShipperName
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ShipperName);
			}
		} 
		
		public esQueryItem ProductID
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ProductID);
			}
		} 
		
		public esQueryItem ProductName
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ProductName);
			}
		} 
		
		public esQueryItem UnitPrice
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.UnitPrice);
			}
		} 
		
		public esQueryItem Quantity
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.Quantity);
			}
		} 
		
		public esQueryItem Discount
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.Discount);
			}
		} 
		
		public esQueryItem ExtendedPrice
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.ExtendedPrice);
			}
		} 
		
		public esQueryItem Freight
		{
			get
			{
				return new esQueryItem(this, InvoiceMetadata.ColumnNames.Freight);
			}
		} 
		
	}
	


	[Serializable]
	[XmlType("InvoiceCollection")]
	public partial class InvoiceCollection : esInvoiceCollection, IEnumerable<Invoice>
	{
		[GeneratedCode]
		public InvoiceCollection()
		{

		}	

		[GeneratedCode]		
		public static implicit operator List<Invoice>(InvoiceCollection coll)
		{
			List<Invoice> list = new List<Invoice>();

			foreach (Invoice emp in coll)
			{
				list.Add(emp);
			}

			return list;
		}		
		
		#region Housekeeping methods
		[GeneratedCode]
		override protected IMetadata Meta
		{
			[GeneratedCode]
			get
			{
				return  InvoiceMetadata.Meta();
			}
		}	

		[GeneratedCode]
		override protected esDynamicQuery GetDynamicQuery()
		{
			if (this.query == null)
			{
				this.query = new InvoiceQuery();
				this.InitQuery(query);
			}
			return this.query;
		}
		
		[GeneratedCode]
		override protected esEntity CreateEntityForCollection(DataRow row)
		{
			return new Invoice(row);
		}

		[GeneratedCode]
		override protected esEntity CreateEntity()
		{
			return new Invoice();
		}
		
		
		[GeneratedCode]
		override public bool LoadAll()
		{
			return base.LoadAll(esSqlAccessType.DynamicSQL);
		}	
			
		#endregion


		[BrowsableAttribute( false )]
		[GeneratedCode]
		public InvoiceQuery Query
		{
			[GeneratedCode]
			get
			{
				if (this.query == null)
				{
					this.query = new InvoiceQuery();
					base.InitQuery(this.query);
				}

				return this.query;
			}
		}

		[GeneratedCode]
		public void QueryReset()
		{
			this.query = null;
		}

		[GeneratedCode]
		public Invoice AddNew()
		{
			Invoice entity = base.AddNewEntity() as Invoice;
			
			return entity;		
		}


		#region IEnumerable<Invoice> Members

		[GeneratedCode]
		IEnumerator<Invoice> IEnumerable<Invoice>.GetEnumerator()
		{
			System.Collections.IEnumerable enumer = this as System.Collections.IEnumerable;
			System.Collections.IEnumerator iterator = enumer.GetEnumerator();

			while(iterator.MoveNext())
			{
				yield return iterator.Current as Invoice;
			}
		}

		#endregion
		
		[GeneratedCode]
		private InvoiceQuery query;
	}
	
	




	
	/// <summary>
	/// Encapsulates the 'Invoices' view
	/// </summary>

	[Serializable]
	public partial class Invoice : esInvoice
	{
		[GeneratedCode]	
		public Invoice()
		{

		}	

		[GeneratedCode]	
		public Invoice(DataRow row)
			: base(row)
		{

		}
		
		#region Housekeeping methods
		[GeneratedCode]
		override protected IMetadata Meta
		{
			[GeneratedCode]
			get
			{
				return InvoiceMetadata.Meta();
			}
		}

		[GeneratedCode]
		override protected esInvoiceQuery GetDynamicQuery()
		{
			if (this.query == null)
			{
				this.query = new InvoiceQuery();
				this.InitQuery(query);
			}
			return this.query;
		}
		#endregion


		[BrowsableAttribute( false )]
		[GeneratedCode]
		public InvoiceQuery Query
		{
			[GeneratedCode]
			get
			{
				if (this.query == null)
				{
					this.query = new InvoiceQuery();
					base.InitQuery(this.query);
				}

				return this.query;
			}
		}

		[GeneratedCode]
		public void QueryReset()
		{
			this.query = null;
		}

		[GeneratedCode]
		private InvoiceQuery query;
	}
	


	[Serializable]
	[GeneratedCode]
	public partial class InvoiceQuery : esInvoiceQuery
	{
		public InvoiceQuery()
		{

		}		

	}
	


	[Serializable]
	[GeneratedCode]
	public partial class InvoiceMetadata : esMetadata, IMetadata
	{
		#region Protected Constructor
		protected InvoiceMetadata()
		{
			_columns = new esColumnMetadataCollection();
			esColumnMetadata c;

			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShipName, 0, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShipName;
			c.CharacterMaxLength = 40;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShipAddress, 1, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShipAddress;
			c.CharacterMaxLength = 60;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShipCity, 2, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShipCity;
			c.CharacterMaxLength = 15;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShipRegion, 3, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShipRegion;
			c.CharacterMaxLength = 15;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShipPostalCode, 4, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShipPostalCode;
			c.CharacterMaxLength = 10;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShipCountry, 5, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShipCountry;
			c.CharacterMaxLength = 15;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.CustomerID, 6, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.CustomerID;
			c.CharacterMaxLength = 5;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.CustomerName, 7, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.CustomerName;
			c.CharacterMaxLength = 40;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.Address, 8, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.Address;
			c.CharacterMaxLength = 60;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.City, 9, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.City;
			c.CharacterMaxLength = 15;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.Region, 10, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.Region;
			c.CharacterMaxLength = 15;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.PostalCode, 11, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.PostalCode;
			c.CharacterMaxLength = 10;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.Country, 12, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.Country;
			c.CharacterMaxLength = 15;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.Salesperson, 13, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.Salesperson;
			c.CharacterMaxLength = 31;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.OrderID, 14, Type.GetType("System.Int32"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.OrderID;
			c.NumericPrecision = 10;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.OrderDate, 15, Type.GetType("System.DateTime"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.OrderDate;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.RequiredDate, 16, Type.GetType("System.DateTime"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.RequiredDate;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShippedDate, 17, Type.GetType("System.DateTime"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShippedDate;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ShipperName, 18, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ShipperName;
			c.CharacterMaxLength = 40;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ProductID, 19, Type.GetType("System.Int32"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ProductID;
			c.NumericPrecision = 10;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ProductName, 20, Type.GetType("System.String"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ProductName;
			c.CharacterMaxLength = 40;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.UnitPrice, 21, Type.GetType("System.Decimal"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.UnitPrice;
			c.NumericPrecision = 19;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.Quantity, 22, Type.GetType("System.Int16"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.Quantity;
			c.NumericPrecision = 5;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.Discount, 23, Type.GetType("System.Single"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.Discount;
			c.NumericPrecision = 7;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.ExtendedPrice, 24, Type.GetType("System.Decimal"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.ExtendedPrice;
			c.NumericPrecision = 19;
			c.IsNullable = true;
			_columns.Add(c); 
				
			c = new esColumnMetadata(InvoiceMetadata.ColumnNames.Freight, 25, Type.GetType("System.Decimal"));	
			c.PropertyName = InvoiceMetadata.PropertyNames.Freight;
			c.NumericPrecision = 19;
			c.IsNullable = true;
			_columns.Add(c); 
				
		}
		#endregion

		static public InvoiceMetadata Meta()
		{
			return meta;
		}	
		
		public Guid DataID
		{
			get { return base._dataID; }
		}	
		
		public bool MultiProviderMode
		{
			get { return false; }
		}		

		public esColumnMetadataCollection Columns
		{
			get	{ return base._columns; }
		}
		
		#region ColumnNames
		[GeneratedCode]
		public class ColumnNames
		{ 
			 public const string ShipName = "ShipName";
			 public const string ShipAddress = "ShipAddress";
			 public const string ShipCity = "ShipCity";
			 public const string ShipRegion = "ShipRegion";
			 public const string ShipPostalCode = "ShipPostalCode";
			 public const string ShipCountry = "ShipCountry";
			 public const string CustomerID = "CustomerID";
			 public const string CustomerName = "CustomerName";
			 public const string Address = "Address";
			 public const string City = "City";
			 public const string Region = "Region";
			 public const string PostalCode = "PostalCode";
			 public const string Country = "Country";
			 public const string Salesperson = "Salesperson";
			 public const string OrderID = "OrderID";
			 public const string OrderDate = "OrderDate";
			 public const string RequiredDate = "RequiredDate";
			 public const string ShippedDate = "ShippedDate";
			 public const string ShipperName = "ShipperName";
			 public const string ProductID = "ProductID";
			 public const string ProductName = "ProductName";
			 public const string UnitPrice = "UnitPrice";
			 public const string Quantity = "Quantity";
			 public const string Discount = "Discount";
			 public const string ExtendedPrice = "ExtendedPrice";
			 public const string Freight = "Freight";
		}
		#endregion	
		
		#region PropertyNames
		[GeneratedCode]
		public class PropertyNames
		{ 
			 public const string ShipName = "ShipName";
			 public const string ShipAddress = "ShipAddress";
			 public const string ShipCity = "ShipCity";
			 public const string ShipRegion = "ShipRegion";
			 public const string ShipPostalCode = "ShipPostalCode";
			 public const string ShipCountry = "ShipCountry";
			 public const string CustomerID = "CustomerID";
			 public const string CustomerName = "CustomerName";
			 public const string Address = "Address";
			 public const string City = "City";
			 public const string Region = "Region";
			 public const string PostalCode = "PostalCode";
			 public const string Country = "Country";
			 public const string Salesperson = "Salesperson";
			 public const string OrderID = "OrderID";
			 public const string OrderDate = "OrderDate";
			 public const string RequiredDate = "RequiredDate";
			 public const string ShippedDate = "ShippedDate";
			 public const string ShipperName = "ShipperName";
			 public const string ProductID = "ProductID";
			 public const string ProductName = "ProductName";
			 public const string UnitPrice = "UnitPrice";
			 public const string Quantity = "Quantity";
			 public const string Discount = "Discount";
			 public const string ExtendedPrice = "ExtendedPrice";
			 public const string Freight = "Freight";
		}
		#endregion	

		public esProviderSpecificMetadata GetProviderMetadata(string mapName)
		{
			MapToMeta mapMethod = mapDelegates[mapName];

			if (mapMethod != null)
				return mapMethod(mapName);
			else
				return null;
		}
		
		#region MAP esDefault
		
		static private int RegisterDelegateesDefault()
		{
			// This is only executed once per the life of the application
            if(InvoiceMetadata.mapDelegates == null)
            {
                InvoiceMetadata.mapDelegates = new Dictionary<string,MapToMeta>();
            }

            if (InvoiceMetadata.meta == null)
            {
                InvoiceMetadata.meta = new InvoiceMetadata();
            }
			
			mapDelegates.Add("esDefault", new MapToMeta(meta.esDefault));
			return 0;
		}			

		private esProviderSpecificMetadata esDefault(string mapName)
		{
			if(!_providerMetadataMaps.ContainsKey(mapName))
			{
				esProviderSpecificMetadata meta = new esProviderSpecificMetadata();
				
				meta.AddTypeMap("ShipName", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ShipAddress", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ShipCity", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ShipRegion", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ShipPostalCode", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ShipCountry", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("CustomerID", new esTypeMap("nchar", "System.String"));
				meta.AddTypeMap("CustomerName", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Address", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("City", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Region", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("PostalCode", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Country", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("Salesperson", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("OrderID", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("OrderDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("RequiredDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("ShippedDate", new esTypeMap("datetime", "System.DateTime"));
				meta.AddTypeMap("ShipperName", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("ProductID", new esTypeMap("int", "System.Int32"));
				meta.AddTypeMap("ProductName", new esTypeMap("nvarchar", "System.String"));
				meta.AddTypeMap("UnitPrice", new esTypeMap("money", "System.Decimal"));
				meta.AddTypeMap("Quantity", new esTypeMap("smallint", "System.Int16"));
				meta.AddTypeMap("Discount", new esTypeMap("real", "System.Single"));
				meta.AddTypeMap("ExtendedPrice", new esTypeMap("money", "System.Decimal"));
				meta.AddTypeMap("Freight", new esTypeMap("money", "System.Decimal"));
			
				
				meta.Schema = "dbo";
				
				meta.Source = "Invoices";
				meta.Destination = "Invoices";
				
				
				meta.spInsert = "proc_InvoicesInsert";				
				meta.spUpdate = "proc_InvoicesUpdate";		
				meta.spDelete = "proc_InvoicesDelete";
				meta.spLoadAll = "proc_InvoicesLoadAll";
				meta.spLoadByPrimaryKey = "proc_InvoicesLoadByPrimaryKey";
			  
				
				this._providerMetadataMaps["esDefault"] = meta;
			}
			
			return this._providerMetadataMaps["esDefault"];
		}

		#endregion

		static private InvoiceMetadata meta;
		static protected Dictionary<string, MapToMeta> mapDelegates;
		static private int _esDefault = RegisterDelegateesDefault();
	}
}

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

dakeefer
Software Developer VirtualScopics, Inc
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150624.2 | Last Updated 22 Jan 2008
Article Copyright 2008 by dakeefer
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid