views:

15

answers:

1

I would like to register an object with a list parameter, but without using a configuration file. this is the configuration file that I currently use:

<?xml version="1.0" encoding="utf-8" ?>
<castle>
  <components>
    <component id="EmailParser"
     service="ESImportCommon.Email.IEmailParser, ESImportCommon"
     type="ESImportCommon.Email.EmailParser, ESImportCommon">
    </component>
  </components>
</castle>

Thanks,

Adam

A: 

You can do it like this:

        using ESImportCommon.Email;

        ....

        var container = new WindsorContainer(new XmlInterpreter()); 
        container.AddFacility<FactorySupportFacility>();
        container.Register(Component.For<IEmailParser>().ImplementedBy<EmailParser>());

Note that you don't need to pass an instance of XmlInterpreter to the constructor if you do not want any configuration in your web/app.config.

klausbyskov