Hi,
I have see several examples of implementation of ReadOnlyList classes. But the fetch method is like this:
private void DataPortal_Fetch(SomeCriteriaClass criteria)
{...}
But, if inside ReadOnlyListBase there is the method: "protected virtual void DataPortal_Fetch(object criteria)" . Is there some performance issue if I use override method inside my inplementation like this:
protected override DataPortal_Fetch(object criteria)
{
SomeCriteriaClass someCriteria = (SomeCriteriaClass)criteria;
}
CSLA internally relies on reflection to make a dynamic call into the object.
So take f.ex a class that have several criteria classes:
private void DataPortal_Fetch(SomeCriteriaClass1 criteria)
{ ... }
private void DataPortal_Fetch(SomeCriteriaClass2 criteria)
{ ... }
private void DataPortal_Fetch(SomeCriteriaClass3 criteria)
{ ... }
The DataPortal_Fetch all have a similar signature with one object as input.
Rather than having 3 Fetch methods we prefer to have on method and test for the actual criteria type.
protected override DataPortal_Fetch(object criteria)
{
// Your code should check for the type of Criteria object.
}
That said, CSLA will check for
So this is not so much about performance as for coding style.
Thanks Jonny
Copyright (c) Marimer LLC