예제 #1
0
        public async Task <IEnumerable <PermissionDto> > HandleAsync(PermissionListQuery query,
                                                                     CancellationToken cancellationToken = default(CancellationToken))
        {
            using (var conn = new SqlConnection(_configuration.HouseholdConnectionString))
            {
                await conn.OpenAsync(cancellationToken);

                var permissions = await conn.QueryAsync <PermissionDto>(@"
                    SELECT Id, Code, Name, Version
                    FROM Permissions
                ");

                return(permissions);
            }
        }
예제 #2
0
        public async Task <IEnumerable <PermissionDto> > HandleAsync(PermissionListQuery query,
                                                                     CancellationToken cancellationToken = default(CancellationToken))
        {
            var permissions = await
                              _db.Permissions
                              .Select(e =>
                                      new PermissionDto
            {
                Id   = e.Id,
                Code = e.Code,
                Name = e.Name
            }
                                      ).AsNoTracking().ToListAsync();

            return(permissions);
        }