In my [OperationContract] attribute I have written three methods like:
[OperationContract(Name="RolebyName")]
[WebInvoke(UriTemplate = "Role/{name}", Method = "GET", RequestFormat =WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,BodyStyle = WebMessageBodyStyle.Bare)]
Role1 GetRole(string name);
[OperationContract(Name="RolebyProviderId")]
[WebInvoke(UriTemplate = "Rolebypid/?pid={providerId}", Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
Role1 GetRolebyId(Guid providerId);
[OperationContract(Name="RolebyCompanyProviderId")]
[WebInvoke(UriTemplate = "RolebyCPid/?companyId={companyId}&providerId={providerId}", Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
Role1 GetRolebyCPId(Guid companyId, Guid providerId);
I am implementing these three methods separately in Service.cs class
My question is... Instead of implementing as three methods separately can I implement a single class and implemnt the methods inside it ?
If so how can I declare the class in [OperationContract] and also implement it in Service.cs;Based on the parameter passed it has to call that particular method ?