Value Conversion data annotation Trying to convert IList<Guid?> to List

29 views Asked by At

Well I am trying to convert IList to List, because I am going to store this data on POSTGRESS, but I am getting error because I have uuid[] type in my property and the warning said iam tring to insert text. So I am wondering what I am doing wrong here on my datacontext

    entity
    .Property(e => e.PersonalID)
    .HasConversion(
        v => System.Text.Json.JsonSerializer.Serialize(v, (JsonSerializerOptions)null),
        v => System.Text.Json.JsonSerializer.Deserialize<List<Guid?>>(v, (JsonSerializerOptions)null),
        new ValueComparer<IList<Guid?>>(
            (c1, c2) => c1.SequenceEqual(c2),
            c => c.Aggregate(0, (a, v) => HashCode.Combine(a, v.GetHashCode())),
             c => (IList<Guid?>)c.ToList<Guid?>()));
});
0

There are 0 answers