c# - Single WCF service for all inheriting class types -


i've got base class structure follows.

class mammal { ... } class human : mammal { ... } class tiger : mammal { ... } class snake : mammal { ... } 

since service performing actions based on properties in mammal class only, see no need create separate web method each type (and 1 use conditional statement otherwise).

the error i'm getting need declare translator or , given recall discussion (can't find now, though), wonder if that's doable @ all. remember telling me inheritance structure not possible recreate when working wcf.

is there way solve or should keep number of exposed services same call receive input of different types each?

edit

to clarify i'm looking for, i'd runt following code.

human human = new human { ... }; tiger tiger = new tiger { ... }; snake snake = new snake { ... };  serviceclient client = new serviceclient(); client.dostuffto(human); client.dostuffto(tiger); client.dostuffto(snake); client.close(); 

the signature service follows.

[operationcontract(name = "dostuffto")] [webinvoke] string dostuffto(mammal mammal); 

have @ serviceknowntypeattribute

and @ article


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -