public ICommandService <TEntity> CreateCommandService() { ICommandProcessing <SqlTransaction> commandProcessor = _commandProcessorFactory.Create(); IMappingAdapter <TEntity> mappingAdapter = _mappingAdapterFactory.Create(); return(CreateCommandService(commandProcessor, mappingAdapter)); }
public IBulkInsertService <TEntity> CreateBulkInsert() { IDatabaseContext <SqlConnection, SqlTransaction> databaseContext = _databaseContextFactory.Create(); IMappingAdapter <TEntity> mappingAdapter = _mappingAdapterFactory.Create(); return(CreateBulkInsert(databaseContext, mappingAdapter)); }
public IBulkMergeService <TEntity> CreateBulkMerge() { ICommandProcessing <SqlTransaction> commandProcessor = _commandProcessorFactory.Create(); IDatabaseContext <SqlConnection, SqlTransaction> databaseContext = _databaseContextFactory.Create(); IMappingAdapter <TEntity> mappingAdapter = _mappingAdapterFactory.Create(); IBulkInsertService <TEntity> bulkInsert = CreateBulkInsert(databaseContext, mappingAdapter); ICommandService <TEntity> commandService = CreateCommandService(commandProcessor, mappingAdapter); return(new BulkMergeService <TEntity>( bulkInsertService: bulkInsert, commandService: commandService )); }
public SqlQueryTranslator(IMappingAdapter <TEntity> mappingAdapter) { _mappingAdapter = mappingAdapter; _statementGeneration = new SQLStatementGenerator <TEntity>(mappingAdapter); }
public SQLStatementGenerator(IMappingAdapter <TEntity> mappingAdapter) { _mappingAdapter = mappingAdapter; }
private ICommandService <TEntity> CreateCommandService(ICommandProcessing <SqlTransaction> commandProcessor, IMappingAdapter <TEntity> mappingAdapter) { var queryTranslator = new SqlQueryTranslator <TEntity>(mappingAdapter); return(new CommandService <TEntity, SqlTransaction>( queryTranslator: queryTranslator, queryProcessor: commandProcessor )); }
private IBulkInsertService <TEntity> CreateBulkInsert(IDatabaseContext <SqlConnection, SqlTransaction> databaseContext, IMappingAdapter <TEntity> mappingAdapter) { IDataTransformer <IEnumerable <TEntity>, IBulkDataReader> datatransformer = new DataReaderDataTransformer <TEntity>(mappingAdapter); return(new BulkInsertService <TEntity, IBulkDataReader>( bulkInsert: new SqlBulkInsert(databaseContext), dataTransformer: datatransformer, mappingAdapter: mappingAdapter )); }
public virtual QueryMappingReference <T> GetQueryReference <T>(string typeName, ITaskExecutor svc, IMappingAdapter db = null) where T : IObjectMapping { /* TEST * Task.Run(async () => * { * var trans = ORMFactory.Instance.CreateTransaction(ORMFactory.Instance.DefaultAdapter); * trans.AddCondition(ORMFactory.Instance.Conditions.HashEqual("key", "fieldA", 12345)); * trans.AddCondition(ORMFactory.Instance.Conditions.HashNotEqual("key", "fieldB", 12345)); * using (var save = trans.GetHash("key", svc)) * { * await save.SetAsync("fieldA", 1); * await save.SetAsync("fieldB", 2); * await save.SetAsync("fieldC", "ccc"); * await trans.ExecuteAsync(svc); * } * }); */ return(new QueryMappingReference <T>(typeName, svc, db)); }
public BulkInsertService(IBulkInsert <TBulkData> bulkInsert, IDataTransformer <IEnumerable <TData>, TBulkData> dataTransformer, IMappingAdapter <TData> mappingAdapter) { _bulkInsert = bulkInsert ?? throw new ArgumentNullException(nameof(bulkInsert)); _dataTransformer = dataTransformer ?? throw new ArgumentNullException(nameof(dataTransformer)); _mappingAdapter = mappingAdapter ?? throw new ArgumentNullException(nameof(mappingAdapter)); }
public DataReaderDataTransformer(IMappingAdapter <TEntity> mappingAdapter) { _mappingAdapter = mappingAdapter; }