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.
 
 
 

18 lines
572 B

using System;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using LanguageExt;
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);
}
}