Beispiel #1
0
        public async Task <Permission> ExecuteAsync(int id, SqlConnection connection, CancellationToken cancellationToken = default)
        {
            using var command = Get(id, connection);
            using var reader  = await command.ExecuteReaderAsync(cancellationToken);

            if (reader.HasRows && await reader.ReadAsync(cancellationToken))
            {
                return(_readerConverter.Convert(reader));
            }

            return(default);
        public async Task ExecuteAsync(Permission.SearchModel model, Permission.SearchResult result, SqlConnection connection, CancellationToken cancellationToken = default)
        {
            using var command = Get(model, connection);
            using var reader  = await command.ExecuteReaderAsync(cancellationToken);

            if (reader.HasRows)
            {
                while (await reader.ReadAsync(cancellationToken))
                {
                    result.Permissions.Add(_readerConverter.Convert(reader));
                }
            }

            result.TotalCount = await ReadTotalCountAsync(reader, cancellationToken);
        }