{"id":78,"date":"2006-01-16T13:53:49","date_gmt":"2006-01-16T20:53:49","guid":{"rendered":"http:\/\/kennyw.com\/indigo\/78"},"modified":"2006-01-16T13:53:49","modified_gmt":"2006-01-16T20:53:49","slug":"default-action-for-your-operationcontract","status":"publish","type":"post","link":"https:\/\/kennyw.com\/?p=78","title":{"rendered":"Default Action for your [OperationContract]"},"content":{"rendered":"<p><strong>Question of the Day<\/strong>: what is the action for my OperationContract?<\/p>\n<p><strong>Answer<\/strong>: if not set explicitly, the action is  contractNamespace + contractName + &#8220;\/&#8221; + operationName.  For responses, tack on &#8220;Response&#8221; at the end of this string.<\/p>\n<p>By default, contractNamespace == &#8220;http:\/\/tempuri.org\/&#8221;, contractName == class name, and operationName == method name.  These names can be specified explicitly through ServiceContractAttribute.Namespace, ServiceContractAttribute.Name, and OperationContractAttribute.Name respectively.<\/p>\n<p>As an example, if you have the following operation:<\/p>\n<div class=\"code\">\n    [<code class=\"classname\">ServiceContract<\/code>]<br \/>\n    <code class=\"keyword\">class<\/code> MyService<br \/>\n    {<\/p>\n<div class=\"indent1\">[<code class=\"classname\">OperationContract<\/code>]<br \/>\n        <code class=\"keyword\">public string<\/code> SampleHello(<code class=\"keyword\">string<\/code> name)<br \/>\n        {<\/p>\n<div class=\"indent1\"><code class=\"keyword\">return string<\/code>.Format(&#8220;Hello {0}.&#8221;, name);<\/div>\n<p>}<\/p><\/div>\n<p>}\n<\/p><\/div>\n<p>the request action is <code class=\"keyword\">http:\/\/tempuri.org\/MyService\/SampleHello<\/code>, and the response action is <code class=\"keyword\">http:\/\/tempuri.org\/MyService\/SampleHelloResponse<\/code>.<\/p>\n<p>Alternatively, you can specify the action(s) of your method with the Action and ReplyAction parameters to OperationContract (i.e. [<code class=\"classname\">OperationContract<\/code>(Action=&#8221;myAction&#8221;, ReplyAction=&#8221;myReplyAction&#8221;)] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Question of the Day: what is the action for my OperationContract? Answer: if not set explicitly, the action is contractNamespace + contractName + &#8220;\/&#8221; + operationName. For responses, tack on &#8220;Response&#8221; at the end of this string. By default, contractNamespace == &#8220;http:\/\/tempuri.org\/&#8221;, contractName == class name, and operationName == method name. These names can be [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-indigo"],"_links":{"self":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":0,"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"wp:attachment":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}