Today, I was working with a collection of entities created by nettiers. This collection is used as a datasource for a grid. My application becomes very slow because each time that one row is created the IsValid property in the base class is forcing to execute the Validate() method, causing that application becomes very slow.
To avoid this bad behavior I have overriding the IsValid property in the entityBase.cs file. The Validate() method MUST TO BE performed ONLY when the IsDirty property is true.
This is the code that improves the performance in the application:
///
/// The base object for each database table entity.
///
Serializable
public abstract partial class EntityBase : EntityBaseCore
{
public override bool IsValid
{
get
{
if (IsDirty)
return base.IsValid;
else
return true;
}
}
}
(Note: this is not a forum, but I thought I would mention something to you, you can edit this out later.
If you plan on adding this function to each of your methods, you can add it to your own template in the file "Entities\EntityBase.cst". That way, it will automatically appear in every entity netTiers creates for you, instead of manually adding it to each class. Enjoy netTiers!)