* re-namespace * optimize usings * more usings * more of the same * more implicit/global usings * cleanup all usings * minor fixes
13 lines
455 B
C#
13 lines
455 B
C#
using System.Linq.Expressions;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ErsatzTV.Infrastructure.Extensions;
|
|
|
|
public static class QueryableExtensions
|
|
{
|
|
public static async Task<Option<T>> SelectOneAsync<T, TKey>(
|
|
this IQueryable<T> enumerable,
|
|
Expression<Func<T, TKey>> keySelector,
|
|
Expression<Func<T, bool>> predicate) where T : class =>
|
|
await enumerable.OrderBy(keySelector).FirstOrDefaultAsync(predicate);
|
|
} |