title: StructureMap .ForConcreteType<T>().Configure.SetProperty configuration does not play ball with BuildUp logic
body: <p>Trying to figure out how to configure StructureMap for property setter injection. I have scenarios where I resolve an instance through the container as well as scenarios where I get an instance elsewhere and then call the congainer.BuildUp() feature.</p>
  
  <p>I have included a sample set of classes below where I want to configure injection for the concrete type Bar. If I use the different options marked 1)-5) below I will get different behaviors from StructureMap. Some of the cases must fail since they are incomplete but all cases where I configure injection on both the Foo and the Qux properties should work. They do not. Especially the .BuildUp() feature does not work.</p>
  
  <p>Rather than me explaining each outcome in detail perhaps some StructureMap wiz out there can be so kind as to point out the flaw in my logic and/or run the sample code?</p>
  
  <p>There are other work around configurations I guess but I'd like to be able to be explicit in what injections I expect on Bar.</p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>[TestClass]
  public class StructureMapTests
  {
      public interface IFoo { }
      public interface IBaz { }
      public interface IQux { }
  
      private class Foo : IFoo { }
  
      private class Baz : IBaz { }
  
      private class Qux : IQux { }
  
      private class Bar
      {
          public IFoo Foo { get; set; }
  
          public IFoo FooSomething { get; set; }
  
          public IBaz Baz { get; set; }
  
          public IQux Qux { get; set; }
      }
  
      Container Container;
  
      [TestInitialize]
      public void Configure_StructureMap()
      {
          Container = new Container();
          Container.Configure(x =&gt;
              {
                  x.For&lt;IFoo&gt;().Use&lt;Foo&gt;();
                  x.For&lt;IBaz&gt;().Use&lt;Baz&gt;();
                  x.For&lt;IQux&gt;().Use&lt;Qux&gt;();
  
                  x.FillAllPropertiesOfType&lt;IBaz&gt;();
                  x.SetAllProperties(policy =&gt;
                  {
                      policy.NameMatches(name =&gt; name.EndsWith("Something"));
                  });
  
                  // 1)
                  //x.ForConcreteType&lt;Bar&gt;().Configure.SetProperty(r =&gt; r.Foo = new Foo());
                  //x.ForConcreteType&lt;Bar&gt;().Configure.Setter&lt;IQux&gt;().IsTheDefault();
  
                  // 2)
                  //x.ForConcreteType&lt;Bar&gt;().Configure.SetProperty(r =&gt; r.Foo = new Foo());
  
                  // 3)
                  //x.ForConcreteType&lt;Bar&gt;().Configure.Setter&lt;IQux&gt;().IsTheDefault();
  
                  // 4)
                  //x.ForConcreteType&lt;Bar&gt;().Configure.Setter&lt;IQux&gt;().IsTheDefault().SetProperty(r =&gt; r.Foo = new Foo());
  
                  // 5)
                  //x.ForConcreteType&lt;Bar&gt;().Configure.SetProperty(r =&gt; r.Foo = new Foo()).Setter&lt;IQux&gt;().IsTheDefault();
              });
      }
  
      [TestMethod]
      public void Resolve_Bar_through_container()
      {
          var bar = Container.GetInstance&lt;Bar&gt;();
  
          Debug.WriteLine("Resolve:");
          Debug.WriteLine(string.Format("Foo is {0}null.", bar.Foo == null ? "" : "not "));
          Debug.WriteLine(string.Format("FooSomething is {0}null.", bar.FooSomething == null ? "" : "not "));
          Debug.WriteLine(string.Format("Baz is {0}null.", bar.Baz == null ? "" : "not "));
          Debug.WriteLine(string.Format("Qux is {0}null.", bar.Qux == null ? "" : "not "));
  
          Assert.IsTrue(bar.Foo != null &amp;&amp; bar.FooSomething != null &amp;&amp; bar.Baz != null &amp;&amp; bar.Qux != null);
      }
  
      [TestMethod]
      public void BuildUp_instance_of_bar()
      {
          var bar = new Bar();
          Container.BuildUp(bar);
  
          Debug.WriteLine("Build up:");
          Debug.WriteLine(string.Format("Foo is {0}null.", bar.Foo == null ? "" : "not "));
          Debug.WriteLine(string.Format("FooSomething is {0}null.", bar.FooSomething == null ? "" : "not "));
          Debug.WriteLine(string.Format("Baz is {0}null.", bar.Baz == null ? "" : "not "));
          Debug.WriteLine(string.Format("Qux is {0}null.", bar.Qux == null ? "" : "not "));
  
          Assert.IsTrue(bar.Foo != null &amp;&amp; bar.FooSomething != null &amp;&amp; bar.Baz != null &amp;&amp; bar.Qux != null);
      }
  }
  </code></pre>