2010-11-30 9 views
1

は、私はこのようなサービスを使用して自分のWeb層(S#のARPアーキテクチャ)に石鹸Webサービスを持っています再度IReportServiceの実装の?S#のARP城注入

ありがとうございました。ここで

クリスチャン

答えて

1

短い答えはです。ReportServiceをyourProject.ApplicationServicesに挿入するだけで注入されます。

長い答えはです:Global.asaxのyourProject.Webには、InitializeServiceLocator()メソッドがあります。これにより、ComponentRegistrarの静的メソッドAddComponentsが呼び出されます。

ComponentRegistrarは、YourProject.web/CastleWindsorにあります。

private static void AddApplicationServicesTo(IWindsorContainer container) 
    { 
     container.Register(
      AllTypes.Pick() 
      .FromAssemblyNamed("NewittsStore.ApplicationServices") 
      .WithService.FirstInterface()); 
    } 
+0

私はこのような何かを試してみました。そこでは、あなたがAddApplicationServicesToを見ればあなたはそれがレジスタyourProject.ApplicationServicesのすべての型(.WithService.FirstInterface())で見ることができます

public static void AddComponentsTo(IWindsorContainer container) { AddGenericRepositoriesTo(container); AddCustomRepositoriesTo(container); AddApplicationServicesTo(container); container.AddComponent("validator", typeof(IValidator), typeof(Validator)); } 

があります。 OK私が追加しました:プライベート静的ボイドAddWebTo(IWindsorContainer容器) {container.Register( AllTypes.Pick() .FromAssemblyNamed( "College.Web") .WithService.FirstInterface())。 }サービス層にWebサービスを追加すべきかどうかはわかりません。 – cs0815

0

がComponentRegistrar.csからです:

/// <summary> 
    /// The add application services to. 
    /// </summary> 
    /// <param name="container"> 
    /// The container. 
    /// </param> 
    private static void AddApplicationServicesTo(IWindsorContainer container) 
    { 
     container.Register(AllTypes.Pick().FromAssemblyNamed("MyAssembly.ApplicationServices").WithService.FirstInterface()); 
    } 

、ここでは、これはあなたを助ける必要があるサービス

private readonly IDocumentManagementService _client; 

    public DocumentService(IDocumentManagementService client) 
    { 
     _client = client; 
    } 

からです。

関連する問題