.net - Serializing abstract class over WCF with subclasses in different assemblies -


we using c# , .net 4 build wcf-enabled application. have "parent" assembly implements:

[datacontract] public abstract class {   //... } 

then, other "child" assemblies implement subclasses of a, this:

[datacontract] public class b : {   //... } 

in assembly have methods trying encapsulate wcf services. of these methods have return type of a.

evidently, child assemblies need include reference parent assembly in order derived classes inherit class a. problem arises when wcf seems demand add knowntype attributes class a list potential subclasses; need parent assembly a resides had references child assemblies, create circular dependencies.

is there other way around this? wcf need know types of potential concrete classes of abstract class being used return type? thank you.

edit. have tried approach based on knowntypeattribute.methodname, suggested comments. allow dynamically load assemblies subclasses reside , return subclasses wcf on demand. works when class a used return type, doesn't work when used method parameter; keep obtaining "type not expected" wcf error. we'll keep trying approaches.

you can set known types when construct serializer might around issue

http://msdn.microsoft.com/en-us/library/aa344259.aspx


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -