public IAsyncEnumerator <T> ExecuteAsyncEnumerator <T>(ITableConfig table, IDatabaseQuery query, DatabaseParameterHandler parameters, ITransactionSource transaction = null) { var reader = this.ExecuteReader(query, parameters, transaction); var mapper = new EntityMapper(table); var visitor = new EntityCompoundEnumeratorVisitor(); var enumerable = new EntityCompoundEnumerator(this, table, mapper, visitor); var buffer = new EntityEnumeratorBuffer(this); var sink = new EntityEnumeratorSink(table); return(enumerable.AsEnumerableAsync <T>(buffer, sink, reader, true)); }
public IEnumerable <T> ExecuteEnumerator <T>(ITableConfig table, IDatabaseQuery query, DatabaseParameterHandler parameters, ITransactionSource transaction = null) { using (var reader = this.ExecuteReader(query, parameters, transaction)) { var mapper = new EntityMapper(table); var visitor = new EntityCompoundEnumeratorVisitor(); var enumerable = new EntityCompoundEnumerator(this, table, mapper, visitor); var buffer = new EntityEnumeratorBuffer(this); var sink = new EntityEnumeratorSink(table); foreach (var element in enumerable.AsEnumerable <T>(buffer, sink, reader)) { yield return(element); } } }
private DatabaseSet() { this.StateDetector = new Lazy <IEntityStateDetector>(() => { var stateDetector = new EntityStateDetector(this.Database, this.Table, this.Source.Composer, this.Transaction); return(stateDetector); }); this.Persister = new Lazy <IEntityPersister>(() => { var mapper = new EntityMapper(this.Table); var visitor = new EntityCompoundPersisterVisitor(this.Database, this.Transaction); var persister = new EntityCompoundPersister(this.Database, this.Table, mapper, visitor, this.Transaction); return(persister); }); this.Enumerator = new Lazy <IEntityEnumerator>(() => { var mapper = new EntityMapper(this.Table); var visitor = new EntityCompoundEnumeratorVisitor(); var enumerator = new EntityCompoundEnumerator(this.Database, this.Table, mapper, visitor); return(enumerator); }); }