public PocoDataDataReader( IEnumerable <T> dataSource, PocoData pd, MicrosoftSqlSyntaxProviderBase <TSyntax> sqlSyntaxProvider) { if (dataSource == null) { throw new ArgumentNullException(nameof(dataSource)); } if (sqlSyntaxProvider == null) { throw new ArgumentNullException(nameof(sqlSyntaxProvider)); } _tableDefinition = DefinitionFactory.GetTableDefinition(pd.Type, sqlSyntaxProvider); if (_tableDefinition == null) { throw new InvalidOperationException("No table definition found for type " + pd.Type); } // only real columns, exclude result/computed columns // Like NPoco does: https://github.com/schotime/NPoco/blob/5117a55fde57547e928246c044fd40bd00b2d7d1/src/NPoco.SqlServer/SqlBulkCopyHelper.cs#L59 _readerColumns = pd.Columns .Where(x => x.Value.ResultColumn == false && x.Value.ComputedColumn == false) .Select(x => x.Value) .ToArray(); _sqlSyntaxProvider = sqlSyntaxProvider; _enumerator = dataSource.GetEnumerator(); _columnDefinitions = _tableDefinition.Columns.ToArray(); }
public PocoDataDataReader( IEnumerable <T> dataSource, PocoData pd, MicrosoftSqlSyntaxProviderBase <TSyntax> sqlSyntaxProvider) { if (dataSource == null) { throw new ArgumentNullException(nameof(dataSource)); } if (sqlSyntaxProvider == null) { throw new ArgumentNullException(nameof(sqlSyntaxProvider)); } _tableDefinition = DefinitionFactory.GetTableDefinition(pd.Type, sqlSyntaxProvider); if (_tableDefinition == null) { throw new InvalidOperationException("No table definition found for type " + pd.Type); } // only real columns, exclude result columns _readerColumns = pd.Columns .Where(x => x.Value.ResultColumn == false) .Select(x => x.Value) .ToArray(); _sqlSyntaxProvider = sqlSyntaxProvider; _enumerator = dataSource.GetEnumerator(); _columnDefinitions = _tableDefinition.Columns.ToArray(); }
public PocoDataDataReader( IEnumerable <T> dataSource, Database.PocoData pd, MicrosoftSqlSyntaxProviderBase <TSyntax> sqlSyntaxProvider) { if (dataSource == null) { throw new ArgumentNullException("dataSource"); } if (sqlSyntaxProvider == null) { throw new ArgumentNullException("sqlSyntaxProvider"); } _tableDefinition = DefinitionFactory.GetTableDefinition(sqlSyntaxProvider, pd.type); if (_tableDefinition == null) { throw new InvalidOperationException("No table definition found for type " + pd.type); } _readerColumns = pd.Columns.Select(x => x.Value).ToArray(); _sqlSyntaxProvider = sqlSyntaxProvider; _enumerator = dataSource.GetEnumerator(); _columnDefinitions = _tableDefinition.Columns.ToArray(); }