/// <summary>
 /// Ctor: Accepts instances via constructor injection
 /// </summary>
 /// <param name="aggregateRepository">Instance of the AggregateRepository</param>
 /// <param name="dataSourceRepository">Instance of the DataSourceRepository</param>
 /// <param name="dataTypeRepository">Instance of the DataType Repository</param>
 /// <param name="importServiceResolver">Instance of the ImportServiceResolver</param>
 /// <param name="dataSourceResolver">Instance of the DataSourceResolver</param>
 public DataService(IAggregateRepository aggregateRepository, IDataSourceRepository dataSourceRepository, IDataTypeRepository dataTypeRepository, IImportServiceResolver importServiceResolver , IDataSourceResolver dataSourceResolver)
 {
     if (aggregateRepository == null)
         throw new ArgumentNullException("aggregateRepository", "No valid AggregateRepository supplied to DataService.");
     if (dataSourceRepository == null)
         throw new ArgumentNullException("dataSourceRepository", "No valid DataSourceRepository supplied to DataService.");
     if (dataTypeRepository == null)
         throw new ArgumentNullException("dataTypeRepository", "No valid DataTypeRepository supplied to DataService.");
     if (importServiceResolver == null)
         throw new ArgumentNullException("importServiceResolver", "No valid ImportServiceResolver supplied to DataService.");
     if (dataSourceResolver == null)
         throw new ArgumentNullException("dataSourceResolver", "No valid DataSourceResolver supplied to DataService.");
     _aggregateRepository = aggregateRepository;
     _dataSourceRepository = dataSourceRepository;
     _dataTypeRepository = dataTypeRepository;
     _importServiceResolver = importServiceResolver;
     _dataSourceResolver = dataSourceResolver;
 }
        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);
        }
示例#6
0
 public DataSourceService(IDataSourceRepository datasourceRepository)
 {
     this._dsRepo = datasourceRepository;
 }
示例#7
0
 public RepositoryFactory(
     IDataSourceRepository dataSourceRepository)
 {
     this.dataSourceRepository = dataSourceRepository;
 }