private readonly IAggregateRepository _repository; // Repository to Aggregate model #endregion Fields #region Constructors protected AbstractImportService(IAggregateRepository repository, IDataSourceRepository dataSourceRepository, IDataSource dataSource, IMatchingAlgorithm matchingAlgorithm, IMapper<ImportAggregate, Aggregate> mapper) { if (repository == null) throw new ArgumentNullException("repository", "Invalid repository specified for import Service"); if (dataSourceRepository == null) throw new ArgumentNullException("dataSourceRepository", "Invalid Datasource repository specified for import Service"); if (dataSource == null) throw new ArgumentNullException("dataSource","Invalid datasource supplied to import Service"); if (matchingAlgorithm == null) throw new ArgumentNullException("matchingAlgorithm", "Invalid matching algorithm supplied to import Service"); if (mapper == null) throw new ArgumentNullException("mapper", "No valid mapper supplied to import service"); _repository = repository; _dataSourceRepository = dataSourceRepository; _datasource = dataSource; _algorithm = matchingAlgorithm; _mapper = mapper; //_mapper = new ImportAggregateToAggregateMapper(); }
/// <summary> /// Ctor: references the RenUkDataSource, otherwise all other dependencies are common /// </summary> /// <param name="repository">Common repository for the Aggregate</param> /// <param name="dataSourceRepository">Common repository for the DataSource</param> /// <param name="dataSource">RenUk Specific DataSource instance</param> /// <param name="matchingAlgorithm">Common Matching algorithm</param> /// <param name="mapper">Mapper class to map importaggregate to aggreate class</param> public RenUkImportService(IAggregateRepository repository, IDataSourceRepository dataSourceRepository, IRenUkDataSource dataSource, IMatchingAlgorithm matchingAlgorithm, IMapper<ImportAggregate, Aggregate> mapper) : base(repository, dataSourceRepository, dataSource, matchingAlgorithm, mapper) { }
public void Initialise() { // Data Context and Repositories _db = new AggregateContext(); _repository = new AggregateRepository(_db); _dataSourceRepository = new DataSourceRepository(_db); _dataTypeRepository = new DataTypeRepository(_db); // No parm, currently Enumeration // DataSources and Resolver var renUkHelper = new RenUkHtmlHelper(); _renUkDatasource = new RenUkDataSource(renUkHelper); var snhHelper = new SnhKmlHelper(); _snhDataSource = new SnhDataSource(snhHelper); _dataSourceResolver = new DataSourceResolver(_snhDataSource, _renUkDatasource); // Matching algorithm _coefficientAlgorithm = new DiceCoefficient(); _similarityAlgorithm = new LcSubstr(); _editDistanceAlgorithm = new LevenshteinEditDistance(); _preProcess = new PreProcessor(); _algorithm = new MatchingAlgorithm(_coefficientAlgorithm, 0.9f, _similarityAlgorithm, 0.9f, _editDistanceAlgorithm, 2, _preProcess); // Mapper class _mapper = new ImportAggregateToAggregateMapper(); // Import Services and Resolver _renUkImportService = new RenUkImportService(_repository, _dataSourceRepository, _renUkDatasource, _algorithm, _mapper); _snhImportService = new SnhImportService(_repository, _dataSourceRepository, _snhDataSource, _algorithm, _mapper); _importServiceResolver = new ImportServiceResolver(_snhImportService, _renUkImportService); }
public void Initialise() { _db = new AggregateContext(); _repository = new AggregateRepository(_db); _dataSourceRepository = new DataSourceRepository(_db); var helper = new SnhKmlHelper(); _datasource = new SnhDataSource(helper); _coefficientAlgorithm = new DiceCoefficient(); _similarityAlgorithm = new LcSubstr(); _editDistanceAlgorithm = new LevenshteinEditDistance(); _preProcess = new PreProcessor(); _algorithm = new MatchingAlgorithm(_coefficientAlgorithm, 0.9f, _similarityAlgorithm, 0.9f, _editDistanceAlgorithm, 2, _preProcess); _mapper = new ImportAggregateToAggregateMapper(); _service = new SnhImportService(_repository, _dataSourceRepository, _datasource, _algorithm, _mapper); }
public void Initialise() { // Create new instance of the algorithms and pre-processor _coefficientAlgorithm = new DiceCoefficient(); _similarityAlgorithm = new LcSubstr(); _editDistanceAlgorithm = new LevenshteinEditDistance(); _preProcessor = new PreProcessor(); // Instantiate the Aggregate Matching algorithm _algorithm = new MatchingAlgorithm(_coefficientAlgorithm, CoefficientLimit, _similarityAlgorithm, SimilarityLimit, _editDistanceAlgorithm, EditDistanceLimit, _preProcessor); // Set up the test aggregates _aggregates = new List<Aggregate>() { new Aggregate() { Id = 1, Name = "Ardrossan", LastUpdated = DateTime.Now, Data = new Collection<AggregateData>() }, new Aggregate() { Id=2, Name = "Ardrossan Extension", LastUpdated = DateTime.Now, Data=new Collection<AggregateData>() }, new Aggregate() { Id = 3, Name = "10 x 50kW Windbank turbines at Tambowie Farm, Milngavie", LastUpdated = DateTime.Now, Data = new Collection<AggregateData>() }, new Aggregate() { Id = 4, Name = "Cathkin Braes", LastUpdated = DateTime.Now, Data = new Collection<AggregateData>() }, new Aggregate() { Id = 5, Name = "Achany Estate", LastUpdated = DateTime.Now, Data = new Collection<AggregateData>() } }; }