Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

13 lines
456 B

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);
}