Click here to Skip to main content
15,885,435 members
Articles / General Programming / Architecture

Binding Web Pages with nHydrate

,
Rate me:
Please Sign up or sign in to vote.
4.71/5 (5 votes)
1 Jun 2011Ms-PL12 min read 20.9K   256   14  
Bind your UI controls to generated objects generically
using System;
using Widgetsphere.EFCore.DataAccess;

namespace Acme.EFExample.EFDAL.Entity
{
	#region CountryPrimaryKey

	/// <summary>
	/// A strongly-typed primary key object for the 'Country' table.
	/// </summary>
	[Serializable()]
	public partial class CountryPrimaryKey : Widgetsphere.EFCore.DataAccess.IPrimaryKey
	{
		/// <summary>
		/// A primary key field of the Country entity
		/// </summary>
		protected int _CountryId;

		/// <summary>
		/// The constructor for this object which takes the fields that comprise the primary key for the 'Country' table.
		/// </summary>
		public CountryPrimaryKey(int countryId)
		{
			_CountryId = countryId;
		}

		/// <summary>
		/// A primary key for the 'Country' table.
		/// </summary>
		public int CountryId
		{
			get { return _CountryId; }
		}

		/// <summary>
		/// Returns a value indicating whether the current object is equal to a specified object.
		/// </summary>
		public override bool Equals(object obj)
		{
			if (obj == null) return false;
			if (obj.GetType() == this.GetType())
			{
			bool retval = true;
			retval &= (this.CountryId == ((Acme.EFExample.EFDAL.Entity.CountryPrimaryKey)obj).CountryId);
				return retval;
			}
			return false;
		}

		/// <summary>
		/// Serves as a hash function for this particular type.
		/// </summary>
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

	}

	#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 Microsoft Public License (Ms-PL)



Written By
Software Developer (Senior) Hewlett Packard
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions