When using abstract types and in Operation Contracts you must use the KnownTypes attribute (or equivalent web.config syntax) to declare to WCF which what subclasses of the given abstract type are allowed to be used. This works ok, but forces you to declare up front what types can be used and if someone adds a new type they must add a KnownTypes attribute for it otherwise WCF will throw exceptions when it is used over a service call. This method is a little awkward, and it also violates the Open Closed principal.
Juval Lowry discusses a better more maintainable approach:
Known Types and The Generic Resolver MSDN Magazine February 2011
No comments:
Post a Comment