public DefaultPayeCalculationEngineFactory(ITaxConfigurationDataProvider taxConfigurationDataProvider) { this.taxConfigurationDataProvider = taxConfigurationDataProvider; var interfaceTypes = typeof(DefaultNiCalculationEngineFactory).Assembly.ExportedTypes .Where(t => typeof(IPayeCalculationEngine).IsAssignableFrom(t)); // One engine can span multiple years var allTypes = interfaceTypes.SelectMany(t => t.GetCustomAttributes(typeof(CalculationEngineTaxYearAttribute), false).Select( a => new { ((CalculationEngineTaxYearAttribute)a).TaxYear, Type = t })); discoveredPayeCalculationEngines = allTypes.ToDictionary(m => m.TaxYear, m => m.Type); }
public DefaultStatutoryCalculationEngineFactory(ITaxConfigurationDataProvider taxConfigurationDataProvider, IBankHolidayConfigurationDataProvider bankHolidayConfigurationDataProvider) { this.taxConfigurationDataProvider = taxConfigurationDataProvider; this.bankHolidayConfigurationDataProvider = bankHolidayConfigurationDataProvider; var interfaceTypes = typeof(DefaultStatutoryCalculationEngineFactory).Assembly.ExportedTypes.Where(t => typeof(IStatutorySickPayCalculationEngine).IsAssignableFrom(t) || typeof(IStatutoryPaternityPayCalculationEngine).IsAssignableFrom(t) || typeof(IStatutoryMaternityPayCalculationEngine).IsAssignableFrom(t) ); // One engine can span multiple years var allTypes = interfaceTypes.SelectMany(t => t.GetCustomAttributes(typeof(CalculationEngineTaxYearAttribute), false).Select( a => new { ((CalculationEngineTaxYearAttribute)a).TaxYear, Type = t })); discoveredSspCalculationEngines = allTypes.Where(t => typeof(IStatutorySickPayCalculationEngine).IsAssignableFrom(t.Type)).ToDictionary(m => m.TaxYear, m => m.Type); discoveredSmpCalculationEngines = allTypes.Where(t => typeof(IStatutoryMaternityPayCalculationEngine).IsAssignableFrom(t.Type)).ToDictionary(m => m.TaxYear, m => m.Type); discoveredSppCalculationEngines = allTypes.Where(t => typeof(IStatutoryPaternityPayCalculationEngine).IsAssignableFrom(t.Type)).ToDictionary(m => m.TaxYear, m => m.Type); }
public DefaultStudentLoanCalculationEngineFactory(ITaxConfigurationDataProvider taxConfigurationDataProvider) { this.taxConfigurationDataProvider = taxConfigurationDataProvider; }