This is what I did at the end, but I really like to start using one of the solutions that Aaron Fisher gave in the long run.
[DataContract(), KnownType(typeof(MyType1)), KnownType(typeof(MyType2))]
public class UntypedObjectHolder
{
[DataMember()]
private object m_Value;
public UntypedObjectHolder(object value)
{
m_Value = value;
}
public object Value
{
get { return m_Value; }
}
}
Then in my interface
[OperationContract()]
UntypedObjectHolder GetValue(eGetValueType valueType);
, , , -
[ServiceContract]
[ServiceKnownType(typeof(PhotoCamera))]
[ServiceKnownType(typeof(TemperatureSensor))]
[ServiceKnownType(typeof(DeviceBase))]
public interface IHomeService
{
[OperationContract] IDevice GetInterface();
}