Abp Castle依赖注入抽象类

时间:2018-09-04 10:42:27

标签: asp.net-core-2.0 castle-windsor aspnetboilerplate

一个抽象类继承了一个接口,然后这个抽象类具有多种实现方式,我该如何注入?


界面:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>


Number : <input maxlength="8" type="number" name="quantity" id="quantity" />

抽象类:

public interface IStatementsDetailService<T> : IApplicationService where T : ReportFinancialStatementsDetailItem, new()
    {
        /// <summary>
        /// 获取销账明细
        /// </summary>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        Task<ReportFinancialStatementsDetailDto<T>>
            ReportFinancialStatementsDetail(ReportFinancialStatementsDetailRequest requestDto);
    }

A:

public abstract class StatementsDetailBaseService<T> : FanjiaFinancialSystemAppServiceBase, IStatementsDetailService<T> where T : ReportFinancialStatementsDetailItem, new(){
   public abstract Task<ReportFinancialStatementsDetailDto<T>> ReportFinancialStatementsDetail(ReportFinancialStatementsDetailRequest requestDto);
}

B:

public class MICEVisaStatementsDetailService : StatementsDetailBaseService<MICEVisaItem>{
 public async override Task<ReportFinancialStatementsDetailDto<MICEVisaItem>> ReportFinancialStatementsDetail(ReportFinancialStatementsDetailRequest requestDto){
 }
}

这是我在模块中的注射:

public class FlightStatementsDetailService : StatementsDetailBaseService<FlightDetailItem>{
 public async override Task<ReportFinancialStatementsDetailDto<FlightDetailItem>> ReportFinancialStatementsDetail(ReportFinancialStatementsDetailRequest requestDto){
 }
}

但是不能用

0 个答案:

没有答案