Hello all. Using adapter:
I use the OnFieldChanged() event on a field to populate a DataSource as follows:
public CatalogueDetailForm(EntityBase2 entity)
: base ()
{
EntityBase2 Entity = entry ;
InitializeComponent();
.....
((CatalogueDetailEntity)Entity).CatDetailCategoryKeyChanged += new EventHandler(KeyChanged);
}
void KeyChanged(object sender, EventArgs e)
{
bindingSourceSubCategories.DataSource = ReferencesManager.GetCatalogueDetailSubCategoryList
(((CatalogueDetailEntity)Entity).CatDetailCategoryKey) ;
}
.....
Problem is, for whatever reason the KeyChanged delegate gets triggered several times when there's a simple change to the CatDetailCategoryKey value. Sometimes it gets triggered seven or eight times after a chane to CatDetailCategoryKey. Obviously, this creates a bottleneck since GetCatalogueDetailSubCategoryList makes a server call each time.
I'm aware that OnFieldChanged() events are used internally by LLBLGen. I haven't really dug deep into code to determine why this problem is happening but I'm wondering if its just not a good idea to use the OnFieldChanged() in this way.
Thanks.
Jeff