It seems to me that any list would want a "GetById" function to pull specific objects out of the list based on their Id. I was hoping to add this to my inherited list bases since it is not available by default, but GetIdValue is protected. Is it possible to create a GetById function that returns an object based on that object's GetIdValue in the list bases?
Example:
MyBusinessBase<T> : Csla.BusinessBase<T>
MyBusinessListBase<T, C> : Csla.BusinessListBase<T, C> where T : MyBusinessListBase<T, C> where C : MyBusinessBase<C>
In MyBusinessListBase, I want:
public C GetByID(object id)
{
foreach (C item in this)
{
if (item.GetIdValue() == id)
return item;
}
}
Thanks,
Mike
You could always create an Interface and include that method.
e.g.
Public Interface IMyBusinessObjectThen you could cast each item to the interface and call GetIdValue.
Public
Overloads ReadOnly Property GetById(ByVal id As Object) As CJoe
Copyright (c) Marimer LLC