P
phancey
hi,
I have a requirement to show "History" of various business objects.
From my aspx page, I call WCF services to access the business objects.
If each business object had its own service I would create an
interface IHistory which has a GetHistory method and make each
required service implement this method. Then I could code the front
end more easily getting the relevant service, casting it to the
interface and calling GetHistory.
However, there are already several business objects within the same
service. I am trying to figure out if there is a way I can use a
generic interface i.e. GetHistory<T> which can be implemented
similarly? I have been using generics and interfaces for a while but
am not an expert who can just figure these things out straightaway. I
can't see the pattern I need to adopt in this case (if there is one).
Can I make the service implement IHistory<Account>, IHistory<Order>
etc and use polymorphism easily or am I better to just code for
GetAccountHistory, GetOrderHistory etc but in this case there will
then be lots of if statements checking first which service needs using
and then which method.
Just need some help from someone a bit more expert at these patterns.
TIA
Phil
I have a requirement to show "History" of various business objects.
From my aspx page, I call WCF services to access the business objects.
If each business object had its own service I would create an
interface IHistory which has a GetHistory method and make each
required service implement this method. Then I could code the front
end more easily getting the relevant service, casting it to the
interface and calling GetHistory.
However, there are already several business objects within the same
service. I am trying to figure out if there is a way I can use a
generic interface i.e. GetHistory<T> which can be implemented
similarly? I have been using generics and interfaces for a while but
am not an expert who can just figure these things out straightaway. I
can't see the pattern I need to adopt in this case (if there is one).
Can I make the service implement IHistory<Account>, IHistory<Order>
etc and use polymorphism easily or am I better to just code for
GetAccountHistory, GetOrderHistory etc but in this case there will
then be lots of if statements checking first which service needs using
and then which method.
Just need some help from someone a bit more expert at these patterns.
TIA
Phil