Files
ersatztv/ErsatzTV.Infrastructure/Data/Configurations/IntCollectionValueConverter.cs
T
Jason DoveandGitHub bec3cb864d update dependencies (#1276)
* update dependencies

* fix ide warnings

* tweak ef config
2023-05-21 10:13:44 -05:00

15 lines
442 B
C#

using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace ErsatzTV.Infrastructure.Data.Configurations;
public class IntCollectionValueConverter : ValueConverter<ICollection<int>, string>
{
public IntCollectionValueConverter() : base(
i => string.Join(",", i),
s => string.IsNullOrWhiteSpace(s)
? Array.Empty<int>()
: s.Split(new[] { ',' }).Select(int.Parse).ToArray())
{
}
}