{"id":4543,"date":"2014-03-30T13:27:43","date_gmt":"2014-03-30T13:27:43","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-wcf-service-have-constructors-collection-of-common-programming-errors\/"},"modified":"2014-03-30T13:27:43","modified_gmt":"2014-03-30T13:27:43","slug":"can-wcf-service-have-constructors-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-wcf-service-have-constructors-collection-of-common-programming-errors\/","title":{"rendered":"Can WCF Service have constructors?-Collection of common programming errors"},"content":{"rendered":"<p>When I new a WCF service in my solution, can I do the following, have a constructor with parameter to pass in? If yes, how, when and where does the runtime fill in my required IBusinessLogic object?<\/p>\n<pre><code>[ServiceContract]\npublic interface IServiceContract\n{\n    [OperationContract]\n    ...\n}\n\npublic class MyService : IServiceContract\n{\n    IBusinessLogic _businessLogic;\n    public ServiceLayer(IBusinessLogic businessLogic)\n    {\n        _businessLogic = businessLogic;\n    }\n    ...\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When I new a WCF service in my solution, can I do the following, have a constructor with parameter to pass in? If yes, how, when and where does the runtime fill in my required IBusinessLogic object? [ServiceContract] public interface IServiceContract { [OperationContract] &#8230; } public class MyService : IServiceContract { IBusinessLogic _businessLogic; public ServiceLayer(IBusinessLogic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4543","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4543"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4543\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}