Click here to Skip to main content
15,892,746 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 CustomerPrimaryKey

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

		/// <summary>
		/// The constructor for this object which takes the fields that comprise the primary key for the 'Customer' table.
		/// </summary>
		public CustomerPrimaryKey(int userId)
		{
			_UserId = userId;
		}

		/// <summary>
		/// A primary key for the 'Customer' table.
		/// </summary>
		public int UserId
		{
			get { return _UserId; }
		}

		/// <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.UserId == ((Acme.EFExample.EFDAL.Entity.CustomerPrimaryKey)obj).UserId);
				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