Click here to Skip to main content
15,886,110 members
Articles / Database Development / SQL Server

Optimizing Performance in NHibernate: Part 2: A Collection of Enhancements

Rate me:
Please Sign up or sign in to vote.
4.86/5 (24 votes)
9 May 2007CPOL19 min read 199.1K   810   110  
This is the second part in a two-piece article focused on optimizing the efficiency of your NHibernate ORM layer.
using System;
using System.Collections;

namespace Northwind.Domain.Entities
{
	/// <summary>
	/// Shipper object for NHibernate mapped table 'Shippers'.
	/// </summary>
    public class Shipper : EntityBase
	{
		#region Member Variables
		
		protected int _id;
		protected string _companyName;
		protected string _phone;
		protected IList _shipViaOrderses;

		#endregion

		#region Constructors

		public Shipper() { }

		public Shipper( string companyName, string phone )
		{
			this._companyName = companyName;
			this._phone = phone;
		}

		#endregion

		#region Public Properties

		public int Id
		{
			get {return _id;}
			set {_id = value;}
		}

		public string CompanyName
		{
			get { return _companyName; }
			set
			{
				if(value != _companyName) IsModified = true;
				_companyName = value;
			}
		}

		public string Phone
		{
			get { return _phone; }
			set
			{
				if(value != _phone) IsModified = true;
				_phone = value;
			}
		}

		public IList ShipViaOrderses
		{
			get
			{
				if (_shipViaOrderses==null)
				{
					_shipViaOrderses = new ArrayList();
				}
				return _shipViaOrderses;
			}
			set { _shipViaOrderses = value; }
		}

		#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
Web Developer
United States United States
Independent contract developer for .NET data-oriented systems.

not much to say about myself but feel free to contact me for any inquiries and comments!

Comments and Discussions