For development purpose we might need to change the service name or others properties .By making changes into service could cause huge damage to business and client as well but we can easily protect it by using Name attributes . For example if we change the interface name to XYZService then we have to use like this [ServiceContract(Name
= "IMyCompanyService")]
Wcf service without changes .
namespace CompanyService
{
[ServiceContract]
public interface IMyCompanyService
{
[OperationContract]
string AddNewEmployee(string id, string name, string address, string city, string salary);
[OperationContract]
string Balance(AccountBalance accountBalance);
}
}
Wcf service with changes name of the interface .
namespace CompanyService
{
[ServiceContract(Name = "IMyCompanyService")]
public interface IXYZService
{
[OperationContract]
string AddNewEmployee(string id, string name, string address, string city, string salary);
[OperationContract]
string Balance(AccountBalance accountBalance);
}
}
No comments:
Post a Comment