Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why entity getter/setter is duplicated in all business class
Message
De
28/03/2007 12:20:43
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Why entity getter/setter is duplicated in all business class
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01209288
Message ID:
01209288
Vues:
63
I looked into 2.4 sample business objects and found that all they contain
same code, like in Customer.cs
public override CustomerEntity Entity
		{
			get
			{
				if (this._entity == null)
				{
					this._entity = this.CreateEntityObject();
				}
				this._entity.SetDataRow(this.DataRow);
				return this._entity;
			}
			set { this._entity = value; }
		}
		private CustomerEntity _entity;
There is no need to duplicate code in each class since Entity is generic type.
So this code can be placed to BusinessObjectGeneric class
Entity property getter and setter methods.

Why code is duplicated in every business object in sample ?
How to remove DataRow usage ?
Andrus
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform