refactor dbcontext lifetime (#258)
* refactor create playout handler * refactor get all playouts handler * refactor delete playout handler * remove dead code * ignore unnamed artists for collections * more repository cleanup * more schedule items refactoring * more playout refactoring * refactor playout builder * refactor ffmpeg profiles * more ffmpeg profile refactoring * rework resolutions * refactor media collections * refactor config elements * update changelog * more cleanup
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using LanguageExt;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Extensions
|
||||
{
|
||||
public static class ConfigElementQueryableExtensions
|
||||
{
|
||||
public static Task<Option<T>> GetValue<T>(
|
||||
this IQueryable<ConfigElement> configElements,
|
||||
ConfigElementKey key) =>
|
||||
configElements
|
||||
.SelectOneAsync(ce => ce.Key, ce => ce.Key == key.Key)
|
||||
.MapT(ce => (T) Convert.ChangeType(ce.Value, typeof(T)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user