.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> WCF >> Post New QuestionBookmark and Share Subscribe to Forum

OperationContract Name and UriTemplate

Posted By: Akhil Raj     Posted Date: February 04, 2014    Points:5   Category :WCF
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.





Responses

No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend