質問

I create a service method. This have OperationName and UriTemplate. I am confusing this 2 names based on my scenario.

    [OperationContract(Name="MyMethod")]
    [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/MyMethod/{p1}")]
    [Description("To get the data")]
    string InternalMethodName(string p1);

My understanding

Operation Contract Name to specify the name of the method like alias. So if i didn't give any UriTemplate the name specified in the name attribute is taken as name like below

Http://myServer/MyService/Service1.svc/MyMethod?p1=value

UriTemplate is is used to bind the paramer bindings so that we can customize the parameter mapping. So if i add UriTemplate like /MyMethod/{p1} he service helps shows like

http://myServer/MyService/Service1.svc/MyMthod/value

Here is my confusion. So if i add both no impact for the name? then which is best practice to use. So can you get me the exact meaning and which is the best practice to use.

役に立ちましたか?

解決

I got the difference. Actually uriTemplate is to mask the input and operation cotract name is the alias name. This link helped me

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top