title: Spring.net is not looking for definition in the parent container
body: <p>In my project I have 2 configurations for spring, one in code and one in xml. The code context will load the mock objects defined in the MockConfigurations class. The xml config is defined in the app.config. I’m setting the xml config as parent of the code config.</p>
  
  <pre><code>public static IApplicationContext GetMergedContainer()
  {
      var scanner = new AssemblyObjectDefinitionScanner();
      scanner.IncludeType&lt;MockConfigurations&gt;();
  
      var context = new CodeConfigApplicationContext(ContextRegistry.GetContext());
      context.Scan(scanner);
      context.Refresh();
      return context;
  }
  </code></pre>
  
  <p>In the spring documentation (<a href="http://www.springframework.net/doc-latest/reference/html/web.html" rel="nofollow">http://www.springframework.net/doc-latest/reference/html/web.html</a>) it says:
  If a referenced object definition is not found in the current context, Spring.NET searches all ancestor contexts in the context hierarchy until it finds the object definition (or ultimately fails and throws an exception).</p>
  
  <p>That is not working for me:</p>
  
  <pre><code>var element = GetMergedContainer().GetObject&lt;IElement&gt;(); 
  </code></pre>
  
  <p>throws Spring.Objects.Factory.NoSuchObjectDefinitionException : No object named '[Namespace].IElement' is defined : Requested Type not Defined in the Context.</p>
  
  <p>Whether the getting the object from the parent works fine:</p>
  
  <pre><code>var element = GetMergedContainer().ParentContext.GetObject&lt;IElement&gt;(); 
  </code></pre>
  
  <p>Am I missing something? Has anyone succeeded in setting an XML context as parent of a code context?</p>
  
  <p>Any help will be appreciated.</p>
  
  <p>Thanks in advance.</p>
  
  <p>I’m using Spring.Core.1.3.2 and Spring.CodeConfig.1.0.4</p>
  
  <p>[UPDATE]</p>
  
  <p>I was recreating the situation with a more simple code (<a href="http://www.springframework.net/codeconfig/refdoc/migration-example.html" rel="nofollow">http://www.springframework.net/codeconfig/refdoc/migration-example.html</a>)</p>
  
  <p>I put again an XML config as parent of the code config and I tried to resolve an object from the code context that exists only in the XML (parent) context.</p>
  
  <p>This works:</p>
  
  <pre><code>ConsoleReport report = ctx["ConsoleReport"] as ConsoleReport;
  ConsoleReport report = ctx.GetObject("ConsoleReport") as ConsoleReport;
  </code></pre>
  
  <p>This fails:</p>
  
  <pre><code>ConsoleReport report = ctx.GetObject&lt;ConsoleReport&gt;();
  </code></pre>
  
  <p>The error is the following:</p>
  
  <blockquote>
    <p>Spring.Objects.Factory.NoSuchObjectDefinitionException was unhandled
     Message=No object named 'Spring.Evaluation.ConsoleReport' is defined : Requested Type not >Defined in the Context.
     Source=Spring.Core.Configuration
     ObjectName=Spring.Evaluation.ConsoleReport
     StackTrace:
          at Spring.Context.ApplicationContextExtensions.GetObject[T](IApplicationContext 
    context) in c:_prj\spring-net-codeconfig\src\Spring.Core.Configuration\Context\Extension\ApplicationContextExtensions.cs:line 69
          at Spring.Evaluation.Program.Main(String[] args) in c:\users\oscar\documents\visual studio 2010\Projects\Spring.Evaluation\Spring.Evaluation\Program.cs:line 16
          at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
          at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
          at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
          at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
          at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
          at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, 
    ContextCallback callback, Object state)
          at System.Threading.ThreadHelper.ThreadStart()</p>
  </blockquote>
  
  <p>I’m trying to add the code configuration to a project (a little big) that uses the later approach, and I would very much like to maintain all those lines of codes as they are.</p>