Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my [OperationContract] attribute I have written three methods like:

C#
[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 ?
Posted
v2

1 solution

Im sorry but I have not seen a single example were this is done in the way you want. Think they would have to be implemented per method as you have done now :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900