{"id":5032,"date":"2014-03-30T18:08:04","date_gmt":"2014-03-30T18:08:04","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/structuremap-strongly-typed-constructor-arguments-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:08:04","modified_gmt":"2014-03-30T18:08:04","slug":"structuremap-strongly-typed-constructor-arguments-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/structuremap-strongly-typed-constructor-arguments-collection-of-common-programming-errors\/","title":{"rendered":"StructureMap strongly-typed constructor arguments-Collection of common programming errors"},"content":{"rendered":"<p>I have a bit of StructureMap config like so:<\/p>\n<pre><code>x.ForConcreteType().Configure\n    .Ctor(\"param1\").EqualToAppSetting(\"setting1\")\n    .Ctor(\"param2\").EqualToAppSetting(\"setting2\")\n    .Ctor(\"param3\").EqualToAppSetting(\"setting3\");\n<\/code><\/pre>\n<p>This works, but it is a bit of a magic-string approach. If I add or remove a constructor parameter, or change its name, but forget to update the StructureMap config, I won&#8217;t find out about it until runtime.<\/p>\n<p>Is there an alternate syntax in StructureMap that is more strongly-typed? Is this even possible?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a bit of StructureMap config like so: x.ForConcreteType().Configure .Ctor(&#8220;param1&#8221;).EqualToAppSetting(&#8220;setting1&#8221;) .Ctor(&#8220;param2&#8221;).EqualToAppSetting(&#8220;setting2&#8221;) .Ctor(&#8220;param3&#8221;).EqualToAppSetting(&#8220;setting3&#8221;); This works, but it is a bit of a magic-string approach. If I add or remove a constructor parameter, or change its name, but forget to update the StructureMap config, I won&#8217;t find out about it until runtime. Is there an alternate [&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-5032","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5032","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=5032"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5032\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5032"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5032"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}