* start to add program schedule alternates * edit days of the week * editor improvements * save changes * build playouts using alternate schedules * reset playout as needed * add priority message
15 lines
527 B
C#
15 lines
527 B
C#
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace ErsatzTV.Infrastructure.Data.Configurations;
|
|
|
|
public class EnumCollectionJsonValueConverter<T> : ValueConverter<ICollection<T>, string> where T : Enum
|
|
{
|
|
public EnumCollectionJsonValueConverter() : base(
|
|
v => JsonConvert.SerializeObject(v.Select(e => e.ToString()).ToList()),
|
|
v => JsonConvert.DeserializeObject<ICollection<string>>(v)
|
|
.Select(e => (T)Enum.Parse(typeof(T), e)).ToList())
|
|
{
|
|
}
|
|
}
|