| | |
| | | public async Task<List<$EntityName$>> GetListByFilterAsync(Expression<Func<$EntityName$, bool>> whereConditions, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .WhereIf(whereConditions != null, whereConditions) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x => x.$OrderBy$) |
| | |
| | | if (isâMultipleThrowException) |
| | | { |
| | | var entitys = await (await GetDbSetAsync()) |
| | | .WhereIf(whereConditions != null, whereConditions) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x => x.$OrderBy$) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | .IncludeDetails() |
| | | .WhereIf(whereConditions != null, whereConditions) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x => x.$OrderBy$) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | if (entitys?.Count > 1) |
| | | { |
| | | throw new UserFriendlyException("æ¥è¯¢å°å¤æ¡è®°å½"); |
| | |
| | | else |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .WhereIf(whereConditions != null, whereConditions) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x => x.$OrderBy$) |
| | | .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); |
| | | .IncludeDetails() |
| | | .WhereIf(whereConditions != null, whereConditions) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x => x.$OrderBy$) |
| | | .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | } |
| | | } |