Example #1
0
        public ResultStreamEnumerator(IContext context, SqlCommandManager manager)
        {
            _isSimpleType = EntityMapping.IsSimpleType <T>();
            _readEntity   = _isSimpleType ? GetSimple : EntityMapping.GetEntityFunc <T>();

            _connection          = AsyncHelper.RunSync(() => manager.CreateConnectionAsync());
            _command             = _connection.CreateCommand();
            _command.Connection  = _connection;
            _command.CommandText = context.CommandText;
            manager.AddParametersToCommand(_command, context);
            _connection.Open();
            _reader = _command.ExecuteReader();
            _map    = _isSimpleType ? null : EntityMapping.MapDbReaderColumns(_reader);
        }
Example #2
0
 public ResultStream(IContext context, SqlCommandManager manager)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _manager = manager ?? throw new ArgumentNullException(nameof(manager));
 }