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 } }
/// <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 } }
public PublicationTests() { _serializer = new JsonMessageSerializer(); _blobStorage = new InMemoryBlobStorage(); _mapper = new InMemoryRecordMapper<FakePublicationRecord>(); _publicationRegistry = new FakeRegistry(_mapper, _blobStorage, _serializer); _channel = new InMemoryMessageChannel(); }
public RecordService(IUnitOfWork unitOfWork, IUserService userService, IRecordGuard guard, IRecordMapper mapper) : base(unitOfWork, userService) { _repository = unitOfWork.RecordRepository; _guard = guard; _mapper = mapper; }
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; }
public DataImport( IDataSource dataSource, IDataDestination dataDestination, IRecordValidator recordValidator = null, IRecordMapper recordMapper = null, IRecordFormatter recordFormatter = null) : this(dataSource, new IDataDestination[] { dataDestination }, recordValidator, recordMapper, recordFormatter) { }
public CreateRecordHandler( IDateTimeProvider dateTimeProvider, IAppCommandContext context, IRecordMapper mapper) { this.dateTimeProvider = dateTimeProvider; this.context = context; this.mapper = mapper; }
public ParallelizedDataImport( IDataSource dataSource, IEnumerable <IDataDestination> dataDestinations, IRecordValidator recordValidator = null, IRecordMapper recordMapper = null, IRecordFormatter recordFormatter = null) : base(dataSource, dataDestinations, recordValidator, recordMapper, recordFormatter) { }
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); } } }
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; }
/// <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; }
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; }
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; }
public MockFileReader(string filePath, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None) : base(filePath, recordMapper, fileShare) { }
public DynamicRecord(IDataRecord record, IRecordMapper[] mappers) { _mappers = mappers; _record = record; _fieldNames = GetDynamicMemberNames().ToList(); ; }
public TextStreamReader(IStreamFactory streamFactory, IRecordMapper recordMapper = null) : base(streamFactory, recordMapper) { }
public TextStreamReader(Stream stream, IRecordMapper recordMapper = null) : base(stream, recordMapper) { }
public EnumerableReader(IEnumerable enumerable, IRecordMapper recordMapper = null) : base(recordMapper) { this.enumerator = enumerable.GetEnumerator(); }
public ComplexMapperColumn(IColumnDefinition column, IRecordMapper <TEntity> mapper) { this.column = column; this.reader = mapper.GetReader(); this.writer = mapper.GetWriter(); }
public RecordService(IUnitOfWorkFactory unitOfWorkFactory, IRecordMapper recordMapper) { _unitOfWorkFactory = unitOfWorkFactory; _recordMapper = recordMapper; }
public DatabaseReader(IRecordMapper recordMapper, SqlCommand command, bool disposeConnection = true) : base(recordMapper) { this.command = command; this.disposeConnection = disposeConnection; }
public RecordRepository(IRecordMapper iRecordMapper, IOptionsMonitor <AzureTableOptions> options) : base(iRecordMapper, options) { }
public MockBinaryStreamReader(IStreamFactory streamFactory, Func <BinaryReader, object> readRecord, IRecordMapper recordMapper = null) : base(streamFactory, recordMapper) { this.readRecord = readRecord; }
public BinaryStreamReader(Stream stream, IRecordMapper recordMapper = null) : base(recordMapper) { this.Stream = stream; }
public TextFileReader(string filePath, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None) : base(new FileStreamFactory(filePath, FileMode.Open, FileAccess.Read, fileShare), recordMapper) { }
protected DataReader(IRecordMapper recordMapper = null) { this.RecordMapper = recordMapper; }
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) { }
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) { }
public MockStreamReader(IStreamFactory streamFactory, Func <System.IO.StreamReader, object> readRecord, IRecordMapper recordMapper = null) : base(streamFactory, recordMapper) { this.readRecord = readRecord; }
public FixedWidthBinaryFileReader(string filePath, IRecordMapper recordMapper = null, FileShare fileShare = FileShare.None) : base(filePath, recordMapper, fileShare) { }
public BinaryStreamReader(IStreamFactory streamFactory, IRecordMapper recordMapper = null) : base(recordMapper) { this.StreamFactory = streamFactory; this.disposeStream = true; }
public MockDataReader(IRecordMapper recordMapper, Func <object> readRecord) : base(recordMapper) { this.readRecord = readRecord; }