I have a class, ReportDef
, which is a concrete class that I've decorated with [DataContract]
and [DataMember]
attributes as needed. ReportDef
is in assembly A1
along with my ServiceContract
, IReportService
. I then have another class, UiReportDef
, which derives from ReportDef
and is in assembly A2
. UiReportDef
has no additional state that the service cares about.
I want to invoke my service with an instance of UiReportDef
. Is there any way (short of manually constructing a ReportDef
instance from UiReportDef
) to do this without having my service know about A2
? I know about KnownType
. I don't want to reference A2
.
EDIT: Here's some context that might make my question easier to understand. My ServiceContract
implements IReportService
which defines a method, RunReport(ReportDef report)
. ReportDef
is decorated with the DataContract
attribute, and has private members decorated with DataMember
. UiReportDef
is in an assembly that depends on UI-related assemblies, etc. I didn't design the existing class hierarchy. I need to pass ReportDefs
and UiReportDefs
(as ReportDefs
) to the new service. Since ReportDef
is concrete, I would expect the serializer to treat UiReportDefs
as ReportDefs
in the absence of any other information.