Service inheritance
Hallo *,
i have a question about how can i add expand a service. Like inhertiance in a object-oriented language.
I created two services with DsspNewService tool named Service_one, Service_two. In the Service_two i changed the line:
Code Snippet
public class Service_twoService : DsspServiceBase
to
Code Snippet
public class Service_twoService : Service_oneService
but if i try to read some values defined in Service_one i got an compiler error:
Error 1 'Service_twoState' does not contain a definition for 'Ticks'
The Ticks property is defined in Service_one.
How can i inherit from another service?
Thanks,
nanostruct
p.s. sorry for my bad english
We actually dont support inheritence in this sense. Services are isolated from each other. Instead, we can do similar extension, by partnering: In service 2, Partner wth service 1, and issue requests to it. When other services no talk to your Service 2, you can respond using the data you got from service 1, without them knowing.
In the more traditional OO sense, you can indeed inherit the *state* type of service 1, in your service 2. So when other services do GET on Service 2, they see an extension of the Service1 data state. But you will still have to send messages to 1, under the covers, in your service 2
In this DSS subforum, search for Alternate Contract, Alternate Port, etc since that is our primary mechanism for extension, "inheritance"
there is a good post from david lee, in this sub forum, on alternate contracts. Also search our sample source for [AlternateContract to see all the services that implement them.
our upcoming Dss user guide will have more documentation as well