We have a server that can return a "configuration", this configuration is a big and complex hierachy of classes.
Our application works by "packages", meaning that we have a "common" base, and then there is part of the application that will not be even installed.
It means that the configurations classes are not all in the same project, and we often have structure like:
public class SomeObject{
public IEnumerable<ISomeObjectChild> Childs{get;set;}
}
public interface SomeObjectChild{
//[...]
}
And in some other project, have some class that implement them:
public class SomeChildImplementation: ISomeObjectChild{
//[...]
}
There is factory to instantiate those kind of childs and everything is working fine.
Now we have to transfer over the network this kind of configuration, using WCF.
My issue is that I know I should indicate what could be the types potentially implementing the ISomeObjectChild
. I know that usually, we should declare them with [KnownType(typeof(SomeChildImplementation))]
, but it is not possible:
- This class doesn't know all its possible childs
- This class cannot even reference thoses childs
So how could I indicate what are the possible implementations?
(in this case it's with an interface, but I've some others cases with abstract classes).