title: How to define a default constructor by code using StructureMap?
body: <p>I can't figure out how to define the default constructor (when it exists overloads) for a type in StructureMap (version 2.5) by code.</p>
  
  <p>I want to get an instance of a service and the container has to inject a Linq2Sql data context instance into it.</p>
  
  <p>I wrote this in my 'bootstrapper' method :</p>
  
  <pre><code>ForRequestedType&lt;MyDataContext&gt;().TheDefault.Is.OfConcreteType&lt;MyDataContext&gt;();
  </code></pre>
  
  <p>When I run my app, I got this error :</p>
  
  <blockquote>
    <p>StructureMap Exception Code:  202<br>
    No Default Instance defined for PluginFamily MyNamespace.Data.SqlRepository.MyDataContext, MyNamespace.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</p>
  </blockquote>
  
  <p>If I comment out all Linq2Sql generated contructors that I don't need, it works fine.</p>
  
  <p>Update : Oh, and I forgot to say that I would not use the <code>[StructureMap.DefaultConstructor]</code> attribute.</p>