choyt (07/27/2007)
That helps. The problem I'm having now is that my FILL methods are custom created and are not being recognized in the sub. I will probably have to resort to late binding and if that is the case, I doubt I will follow this path.Clay,
A few options to possibly avoid late binding.
- Fill the BOs before they are passed. This may or may not be feasible, but it is at least more possible that you'd know what the Fill methods are on the calling side.
- It might be possible to create an abstract class that inherits from BusinessLayer and has a MustOverride method that is used to fill the BO. See the code below:
Public MustInherit Class CachedBO
Inherits BusinessLayer
' This method must be overridden in classes that inherit from CachedBO
Public MustOverride FillForCache()
End Class
Note that this is the entire class needed. You'd then change any BO that is to be cached to inherit from CachedBO instead of BusinessLayer and implement the FillForCache() method in each of them and have DoIt use CachedBO:
Public Sub DoIt(a As CachedBO)
a.FillForCache()
End Sub
This could work very nicely if the parameters needed to fill the BO are common between the Fill methods, or you can figure out some other way to get the Fill methods the data they need, like using properties on the BO. If data needed by the Fill methods is different then this likely won't work out.
- An interface might work, but only if you don't need any of the method/properties of the BusinessLayer and the Fill methods can be generalized (have the same signature).
Anyway, some food for thought.