public void ConfigureServices(IServiceCollection services) { services.AddMvc(); // For this example we will only recognise image-based formats. var recognised = FileFormatLocator.GetFormats().OfType <Image>(); var inspector = new FileFormatInspector(recognised); services.AddSingleton <IFileFormatInspector>(inspector); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // Add the the file format inspector var recognised = FileFormatLocator.GetFormats().OfType <Image>(); var inspector = new FileFormatInspector(recognised); services.AddSingleton <IFileFormatInspector>(inspector); }
public void LocatesConcreteFormatsInAssembly() { var expected = typeof(FileFormat) .GetTypeInfo() .Assembly .GetTypes() .Where(t => typeof(FileFormat).IsAssignableFrom(t)) .Where(t => !t.GetTypeInfo().IsAbstract) .Where(t => t.GetConstructors().Any(c => c.GetParameters().Count() == 0)) .Select(t => Activator.CreateInstance(t)) .OfType <FileFormat>(); var result = FileFormatLocator.GetFormats(); Assert.Equal(expected, result); }
public static IServiceCollection ConfigureServices(this IServiceCollection services) { services.AddScoped <ILoanApplicationService, LoanApplicationService>(); services.AddScoped <IIndustryClassificationService, IndustryClassificationService>(); services.AddScoped <IBusinessTypeService, BusinessTypeService>(); services.AddScoped <IBusinessService, BusinessService>(); services.AddScoped <IGeneralExpenseGroupService, GeneralExpenseGroupService>(); services.AddScoped <IBusinessTypeExpenseGroupService, BusinessTypeExpenseGroupService>(); services.AddScoped <IBusinessTypeCostOfSaleGroupService, BusinessTypeCostOfSaleGroupService>(); services.AddScoped <IBusinessExpenseGroupService, BusinessExpenseGroupService>(); services.AddScoped <IBusinessCostOfSaleService, BusinessCostOfSaleService>(); services.AddScoped <ILoanBorrowerService, LoanBorrowerService>(); services.AddScoped <ISavingsDepositService, SavingsDepositService>(); services.AddScoped <IFixedDepositService, FixedDepositService>(); services.AddScoped <IExistingLoanService, ExistingLoanService>(); services.AddScoped <IRepaymentScheduleService, RepaymentScheduleService>(); services.AddScoped <IBalanceSheetItemService, BalanceSheetItemService>(); services.AddScoped <IVehicularBalanceSheetItemService, VehicularBalanceSheetItemService>(); services.AddScoped <IRealPropertyBalanceSheetItemService, RealPropertyBalanceSheetItemService>(); services.AddScoped <IBalanceSheetSummaryService, BalanceSheetSummaryService>(); services.AddScoped <IPersonalExpenseService, PersonalExpenseService>(); services.AddScoped <IPersonalExpenseTemplateService, PersonalExpenseTemplateService>(); services.AddScoped <IFinancialRatioService, FinancialRatioService>(); services.AddScoped <ISavingsDailyBalanceService, SavingsDailyBalanceService>(); services.AddScoped <ICashFlowService, CashFlowService>(); services.AddScoped <IBuyOutLoanService, BuyOutLoanService>(); services.AddScoped <IUserLoanApplicationService, UserLoanApplicationService>(); services.AddScoped <IImageGroupService, ImageGroupService>(); var recognised = FileFormatLocator.GetFormats().OfType <Image>(); var inspector = new FileFormatInspector(recognised); services.AddSingleton <IFileFormatInspector>(inspector); services.AddScoped <ICreditInvestigationService, CreditInvestigationService>(); services.AddScoped <ICollateralItemService, CollateralItemService>(); services.AddScoped <IBorrowerChildService, BorrowerChildService>(); return(services); }
static FastImageFormatChecker() { var recognised = FileFormatLocator.GetFormats().OfType <Image>(); Checker = new FileFormatInspector(recognised); }