Interoperability when returning derived class by base class in WCF

Posted by mt_serg on Stack Overflow See other posts from Stack Overflow or by mt_serg
Published on 2010-04-30T09:17:13Z Indexed on 2010/04/30 19:27 UTC
Read the original article Hit count: 290

Filed under:
|
|
|
|

I have some simple code:

   [DataContract]
   [KnownType(typeof(SpecialEvent))]
   public class Event
   {
     //data
   }

   [DataContract]
   public class SpecialEvent : Event
   {
     //data
   } 

   [ServiceContract]
   public interface IService
   {
        [OperationContract]
        List<Event> GetEvents();
   }

    [ServiceBehavior]
    public class Service : IService
    {
       public List<Event> GetEvents()
       {
           List<Event> events = new  List<Event>();
           events.Add(new Event());
           events.Add(new SpecialEvent());
           return events;
       }
    }

I know that it works fine in case wcf to wcf.

but what about interoperability?

is it generate standart wsdl and any client can use the service or no?

© Stack Overflow or respective owner

Related posts about wcf

Related posts about web-services