title: How to write a custom windsor activator that creates objects by a string?
body: <p>I have a console application that recieves a class name and calls a function of it:  </p>
  
  <pre><code>Assembly asm = Assembly.GetEntryAssembly();
  ObjectHandle oh = Activator.CreateInstance(asm.FullName, typeName);
  
  IScheduledTask task = (IScheduledTask)oh.Unwrap();
  task.Execute();
  </code></pre>
  
  <p>Until now, there was no need for initialization to occur besides that but now we have some components that IScheduledTask will depand on, through constructor injection.<br>
  Is there a way to define a named instance with the same name of the class, that will later on resolve all dependencies using resolve?<br>
  That is if I get "SomeScheduledTask" as a parameter I can do this:  </p>
  
  <pre><code>IScheduledTask task = (IScheduledTask)container.Resolve(typeName); // I know this is possible. The problem is the registration.
  </code></pre>
  
  <p>Can I do something like this to resolve my issue:</p>
  
  <pre><code>container.Register(Component.For&lt;IScheduledTask&gt;().Named(t =&gt; t.Name).Activator&lt;MyActivator&gt;())
  </code></pre>
  
  <p>And in my activator do something like this:</p>
  
  <pre><code>public class MyActivator : IComponentActivator
  {
       public object Create(CreationContext context)
      {
          string typeName = context.???; // How do I get the named instance name from here?
          Assembly asm = Assembly.GetEntryAssembly();
          ObjectHandle oh = Activator.CreateInstance(asm.FullName, typeName);
  
          IScheduledTask task = (IScheduledTask)oh.Unwrap();
          task.Execute();
      }
  
      public void Destroy(object instance)
      {
  
      }
  }
  </code></pre>