Exemplo n.º 1
0
 public PersonController(IPersonAppService iPersonAppService,
                         IRecordAppService iRecordAppService,
                         IFaceAppService iFaceAppService,
                         IEmotionAppService iEmotionAppService,
                         IReportAppService iReportAppService,
                         IPersonMapper iPersonMapper,
                         IRecordMapper iRecordMapper,
                         IEmotionMapper iEmotionMapper,
                         IReportMapper iReportMapper)
 {
     this.iPersonAppService = iPersonAppService ??
                              throw new ArgumentNullException(nameof(iPersonAppService));
     this.iRecordAppService = iRecordAppService ??
                              throw new ArgumentNullException(nameof(iRecordAppService));
     this.iFaceAppService = iFaceAppService ??
                            throw new ArgumentNullException(nameof(iFaceAppService));
     this.iEmotionAppService = iEmotionAppService ??
                               throw new ArgumentNullException(nameof(iEmotionAppService));
     this.iReportAppService = iReportAppService ??
                              throw new ArgumentNullException(nameof(iReportAppService));
     this.iPersonMapper = iPersonMapper ??
                          throw new ArgumentNullException(nameof(iPersonMapper));
     this.iRecordMapper = iRecordMapper ??
                          throw new ArgumentNullException(nameof(iRecordMapper));
     this.iEmotionMapper = iEmotionMapper ??
                           throw new ArgumentNullException(nameof(iEmotionMapper));
     this.iReportMapper = iReportMapper ??
                          throw new ArgumentNullException(nameof(iReportMapper));
 }
        /// <summary>
        /// Writes index files into the specified directory.
        /// </summary>
        /// <param name="indexDirectory">The directory into which the index files should be written.</param>
        /// <param name="recordMapper">The mapper for the records.</param>
        /// <param param name="records">The records which should be written.</param>
        public void WriteDirectory(DirectoryInfo indexDirectory, IRecordMapper<string> recordMapper, IEnumerable<IReferenceRecord> records)
        {
            if (!indexDirectory.Exists)
            {
                indexDirectory.Create();
            }

            var directoryNames = new HashSet<string>();
            foreach (var directory in indexDirectory.GetDirectories())
            {
                if (!directoryNames.Contains(directory.Name))
                {
                    directoryNames.Add(directory.Name);
                }
            }
            foreach (var record in records)
            {
                var directoryName = recordMapper.Map(record);
                if (!directoryNames.Contains(directoryName))
                {
                    indexDirectory.CreateSubdirectory(directoryName);
                    directoryNames.Add(directoryName);
                }

                // Write index files into the index directory
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Writes index files into the specified directory.
        /// </summary>
        /// <param name="indexDirectory">The directory into which the index files should be written.</param>
        /// <param name="recordMapper">The mapper for the records.</param>
        /// <param param name="records">The records which should be written.</param>
        public void WriteDirectory(DirectoryInfo indexDirectory, IRecordMapper <string> recordMapper, IEnumerable <IReferenceRecord> records)
        {
            if (!indexDirectory.Exists)
            {
                indexDirectory.Create();
            }

            var directoryNames = new HashSet <string>();

            foreach (var directory in indexDirectory.GetDirectories())
            {
                if (!directoryNames.Contains(directory.Name))
                {
                    directoryNames.Add(directory.Name);
                }
            }
            foreach (var record in records)
            {
                var directoryName = recordMapper.Map(record);
                if (!directoryNames.Contains(directoryName))
                {
                    indexDirectory.CreateSubdirectory(directoryName);
                    directoryNames.Add(directoryName);
                }

                // Write index files into the index directory
            }
        }
Exemplo n.º 4
0
		public PublicationTests()
		{
			_serializer = new JsonMessageSerializer();
			_blobStorage = new InMemoryBlobStorage();
			_mapper = new InMemoryRecordMapper<FakePublicationRecord>();
			_publicationRegistry = new FakeRegistry(_mapper, _blobStorage, _serializer);
			_channel = new InMemoryMessageChannel();
		}
Exemplo n.º 5
0
        public RecordService(IUnitOfWork unitOfWork, IUserService userService, IRecordGuard guard, IRecordMapper mapper)
            : base(unitOfWork, userService)
        {
            _repository = unitOfWork.RecordRepository;

            _guard  = guard;
            _mapper = mapper;
        }
Exemplo n.º 6
0
 public RecordModelService(IRecordMapper mapper, IRecordService service)
 {
     if (service == null || mapper == null)
     {
         throw new ArgumentNullException("Cannot pass null as argument for AuthorModelService constructor");
     }
     _mapper  = mapper;
     _service = service;
 }
Exemplo n.º 7
0
 public DataImport(
     IDataSource dataSource,
     IDataDestination dataDestination,
     IRecordValidator recordValidator = null,
     IRecordMapper recordMapper       = null,
     IRecordFormatter recordFormatter = null)
     : this(dataSource, new IDataDestination[] { dataDestination }, recordValidator, recordMapper, recordFormatter)
 {
 }
Exemplo n.º 8
0
 public CreateRecordHandler(
     IDateTimeProvider dateTimeProvider,
     IAppCommandContext context,
     IRecordMapper mapper)
 {
     this.dateTimeProvider = dateTimeProvider;
     this.context          = context;
     this.mapper           = mapper;
 }
Exemplo n.º 9
0
 public ParallelizedDataImport(
     IDataSource dataSource,
     IEnumerable <IDataDestination> dataDestinations,
     IRecordValidator recordValidator = null,
     IRecordMapper recordMapper       = null,
     IRecordFormatter recordFormatter = null)
     : base(dataSource, dataDestinations, recordValidator, recordMapper, recordFormatter)
 {
 }
Exemplo n.º 10
0
        public void Can_Map_Records_Using_IMapper(int sizes)
        {
            IList <SourceRecord> source = DataGenerator.GenerateSourceRecords(sizes);
            IList <TargetRecord> target = IRecordMapper.From(source);

            Assert.NotNull(target);

            foreach (SourceRecord _source in source)
            {
                Assert.Contains(target, t => t.GUID == _source.Id);
                foreach (TargetRecord _target in target.Where(t => t.GUID == _source.Id).ToList())
                {
                    Assert.True(_source.Id == _target.GUID);
                    Assert.True(_source.Character == _target.CHAR);
                    Assert.True(_source.Money == _target.DECIMAL);
                    Assert.Equal(_source.DecimalArray, _target.DECIMAL_ARRAY);
                    Assert.Equal(_source.DecimalList, _target.DECIMAL_LIST);
                    Assert.True(_source.Currency == _target.DOUBLE);
                    Assert.Equal(_source.DoubleArray, _target.DOUBLE_ARRAY);
                    Assert.Equal(_source.DoubleList, _target.DOUBLE_LIST);
                    Assert.True(_source.Percentage == _target.FLOAT);
                    Assert.Equal(_source.FloatArray, _target.FLOAT_ARRAY);
                    Assert.Equal(_source.FloatList, _target.FLOAT_LIST);
                    Assert.Same(_source.InnerSource.Object, _target.OUTER.OBJECT);
                    Assert.Equal(_source.InnerSource.ObjectArray, _target.OUTER.OBJECT_ARRAY);
                    Assert.Equal(_source.InnerSource.ObjectList, _target.OUTER.OBJECT_LIST);
                    Assert.Same(_source.JustNullInner, _target.NULL_OUTER);
                    Assert.Same(_source.JustNullInnerArray, _target.NULL_OUTER_ARRAY);
                    Assert.Same(_source.JustNullInnerList, _target.NULL_OUTER_LIST);
                    Assert.Same(_source.InnerSource.Object, _target.OUTER.OBJECT);
                    Assert.Equal(_source.InnerSource.ObjectArray, _target.OUTER.OBJECT_ARRAY);
                    Assert.Equal(_source.InnerSource.ObjectList, _target.OUTER.OBJECT_LIST);
                    Assert.Equal(_source.LongArray, _target.LONG_ARRAY);
                    Assert.Equal(_source.LongList, _target.LONG_LIST);
                    Assert.True(_source.LongNumber == _target.LONG);
                    Assert.True(_source.Name == _target.STRING);
                    Assert.Equal(_source.NameArray, _target.STRING_ARRAY);
                    Assert.Equal(_source.NameList, _target.STRIN_LIST);
                    Assert.True(_source.Number == _target.INT);
                    Assert.Equal(_source.NumberArray, _target.INT_ARRAY);
                    Assert.Equal(_source.NumberList, _target.INT_LIST);
                    Assert.True(_source.ToGuidValue == _target.STRING_GUID.ToString());
                    Assert.True(_source.ToStringValue.ToString() == _target.GUID_STRING);
                    Assert.Same(_source.ClassProperty.Object, _target.CLASS.OBJECT);
                    Assert.Equal(_source.ClassProperty.ObjectArray, _target.CLASS.OBJECT_ARRAY);
                    Assert.Equal(_source.ClassProperty.ObjectList, _target.CLASS.OBJECT_LIST);
                    Assert.Same(_source.StructProperty.Object, _target.STRUCT.OBJECT);
                    Assert.Equal(_source.StructProperty.ObjectArray, _target.STRUCT.OBJECT_ARRAY);
                    Assert.Equal(_source.StructProperty.ObjectList, _target.STRUCT.OBJECT_LIST);
                }
            }
        }
Exemplo n.º 11
0
 public DataImport(
     IDataSource dataSource,
     IEnumerable <IDataDestination> dataDestinations,
     IRecordValidator recordValidator = null,
     IRecordMapper recordMapper       = null,
     IRecordFormatter recordFormatter = null)
 {
     this.DataSource       = dataSource;
     this.DataDestinations = dataDestinations;
     this.RecordValidator  = recordValidator;
     this.RecordMapper     = recordMapper;
     this.RecordFormatter  = recordFormatter;
 }
Exemplo n.º 12
0
        /// <summary>
        /// Maps and inserts all records from the source table into the destination
        /// table. The source and destination table are specified in the rules member
        /// variable. If the extract association pattern was called then it will also
        /// insert another table into the assocation table for each record.
        /// </summary>
        /// <param name="mapper"></param>
        /// <returns></returns>
        public int InsertMappedFields(IRecordMapper mapper)
        {
            var affected = 0;
            Dictionary<string, object> record;
            while (null != (record = this.src.ExtractRecord(rules.SrcTableName))) {
                affected += this.dest.InsertRecord(
                    this.rules.DestTableName,
                    mapper.MapRecord(record));
                var id = this.dest.GetIdLastInsert();

                if (null != this.extractAssociation)
                    this.extractAssociation.InsertAssociationInserts(record, id);
            }
            return affected;
        }
Exemplo n.º 13
0
        public DynamicConnection(IDbConnection realConnection, params IRecordMapper[] mappers)
        {
            if (realConnection == null)
            {
                throw new ArgumentNullException("realConnection");
            }

            if (mappers == null)
            {
                mappers = new IRecordMapper[0];
            }

            _conn    = realConnection;
            _mappers = mappers;
        }
Exemplo n.º 14
0
        public DynamicConnection(IDbConnection realConnection, params IRecordMapper[] mappers)
        {
            if (realConnection == null)
            {
                throw new ArgumentNullException("realConnection");
            }

            if (mappers == null)
            {
                mappers = new IRecordMapper[0];
            }

            _conn = realConnection;
            _mappers = mappers;
        }
Exemplo n.º 15
0
 public MockFileReader(string filePath, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None)
     : base(filePath, recordMapper, fileShare)
 {
 }
Exemplo n.º 16
0
 public DynamicRecord(IDataRecord record, IRecordMapper[] mappers)
 {
     _mappers = mappers;
     _record = record;
     _fieldNames = GetDynamicMemberNames().ToList(); ;
 }
Exemplo n.º 17
0
 public TextStreamReader(IStreamFactory streamFactory, IRecordMapper recordMapper = null)
     : base(streamFactory, recordMapper)
 {
 }
Exemplo n.º 18
0
 public TextStreamReader(Stream stream, IRecordMapper recordMapper = null)
     : base(stream, recordMapper)
 {
 }
Exemplo n.º 19
0
 public EnumerableReader(IEnumerable enumerable, IRecordMapper recordMapper = null)
     : base(recordMapper)
 {
     this.enumerator = enumerable.GetEnumerator();
 }
Exemplo n.º 20
0
 public ComplexMapperColumn(IColumnDefinition column, IRecordMapper <TEntity> mapper)
 {
     this.column = column;
     this.reader = mapper.GetReader();
     this.writer = mapper.GetWriter();
 }
Exemplo n.º 21
0
 public RecordService(IUnitOfWorkFactory unitOfWorkFactory, IRecordMapper recordMapper)
 {
     _unitOfWorkFactory = unitOfWorkFactory;
     _recordMapper      = recordMapper;
 }
Exemplo n.º 22
0
 public DatabaseReader(IRecordMapper recordMapper, SqlCommand command, bool disposeConnection = true)
     : base(recordMapper)
 {
     this.command           = command;
     this.disposeConnection = disposeConnection;
 }
Exemplo n.º 23
0
 public RecordRepository(IRecordMapper iRecordMapper,
                         IOptionsMonitor <AzureTableOptions> options)
     : base(iRecordMapper, options)
 {
 }
Exemplo n.º 24
0
 public MockBinaryStreamReader(IStreamFactory streamFactory, Func <BinaryReader, object> readRecord, IRecordMapper recordMapper = null)
     : base(streamFactory, recordMapper)
 {
     this.readRecord = readRecord;
 }
Exemplo n.º 25
0
 public BinaryStreamReader(Stream stream, IRecordMapper recordMapper = null)
     : base(recordMapper)
 {
     this.Stream = stream;
 }
Exemplo n.º 26
0
 public TextFileReader(string filePath, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None)
     : base(new FileStreamFactory(filePath, FileMode.Open, FileAccess.Read, fileShare), recordMapper)
 {
 }
Exemplo n.º 27
0
 protected DataReader(IRecordMapper recordMapper = null)
 {
     this.RecordMapper = recordMapper;
 }
Exemplo n.º 28
0
 public MockFileReader(string[] records, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None)
     : base(null, recordMapper, fileShare)
 {
     this.records = records;
 }
 public FixedWidthBinaryStreamReader(IStreamFactory streamFactory, IRecordMapper recordMapper = null)
     : base(streamFactory, recordMapper)
 {
 }
Exemplo n.º 30
0
 public FileReader(string filePath, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None)
     : base(recordMapper)
 {
     this.FilePath  = filePath;
     this.FileShare = fileShare;
 }
 public FixedWidthBinaryStreamReader(Stream stream, IRecordMapper recordMapper = null)
     : base(stream, recordMapper)
 {
 }
Exemplo n.º 32
0
 public MockStreamReader(IStreamFactory streamFactory, Func <System.IO.StreamReader, object> readRecord, IRecordMapper recordMapper = null)
     : base(streamFactory, recordMapper)
 {
     this.readRecord = readRecord;
 }
Exemplo n.º 33
0
 public FixedWidthBinaryFileReader(string filePath, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None)
     : base(filePath, recordMapper, fileShare)
 {
 }
Exemplo n.º 34
0
 public BinaryStreamReader(IStreamFactory streamFactory, IRecordMapper recordMapper = null)
     : base(recordMapper)
 {
     this.StreamFactory = streamFactory;
     this.disposeStream = true;
 }
Exemplo n.º 35
0
 public MockDataReader(IRecordMapper recordMapper, Func <object> readRecord)
     : base(recordMapper)
 {
     this.readRecord = readRecord;
 }