- ITemperature
- IRainfall
The former returns the temperature of a particular location and the latter returns rainfall measure. Now suppose we have another interface called IWeather which will hold the functionality of returning weather forecast. The below code shows how to achieve this functionality using C#
namespace AggregatedContracts{
[ServiceContract]
public interface ITemperature
{
[OperationContract]
double GetTemperature(double latitude, double longitude);
}
[ServiceContract]
public interface IRainfall
{
[OperationContract]
double GetRainfall(double latitude, double longitude);
}
ServiceContract]
public interface IWeather : ITemperature,IRainfall{};
{
[OperationContract]
string GetWeatherForecast(double latitude, double longitude);
}
public class WeatherInfo : IWeather{
//implement ITemperature
//implement IRainfall
}
}
Technorati Tags: WCF,Multiple contracts,Multiple interfaces,WCF multiple contracts,WCF more than one contract,WCF many contracts,Aggregate Interfaces,Aggregate Contracts
No comments:
Post a Comment