1

リスト パラメーターを使用してオブジェクトを登録したいのですが、構成ファイルは使用しません。これは私が現在使用している構成ファイルです。

<?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>
4

1 に答える 1

1

次のように実行できます。

        using ESImportCommon.Email;

        ....

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

web/app.config で構成が不要XmlInterpreterな場合は、コンストラクターにのインスタンスを渡す必要がないことに注意してください。

于 2010-10-05T13:55:33.093 に答える