Wednesday, April 08, 2009

Overloading methods in WCF

Service oriented development is different than the Object oriented programming. Overloading methods is possible in WCF, but not recommended.

To make it work in WCF, you'll need to add Name property

[ServiceContract]
public interface ICalendarService
{
[OperationContract(Name = "GetScheduledEventsByDate")]
ScheduledEvent[] GetScheduledEvents(DateTime date);

[OperationContract(Name = "GetScheduledEventsByDateRange")]
ScheduledEvent[] GetScheduledEvents(DateTime start, DateTime end);
}

For more info: here

No comments: