actually use the jsonconversion

This commit is contained in:
Lynne Megido 2020-09-16 09:58:10 +10:00
parent be9b0c3d9d
commit 88026c07f8
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

View file

@ -17,19 +17,8 @@ namespace Snootalogue.Data {
}
protected override void OnModelCreating(ModelBuilder modelBuilder) {
modelBuilder.Entity<Document>()
.Property(item => item.Authors)
.HasConversion(
value => JsonSerializer.Serialize(value, null),
value => JsonSerializer.Deserialize<List<string>>(value, null)
);
modelBuilder.Entity<Document>()
.Property(item => item.Tags)
.HasConversion(
value => JsonSerializer.Serialize(value, null),
value => JsonSerializer.Deserialize<List<string>>(value, null)
);
modelBuilder.Entity<Document>().Property(item => item.Authors).HasJsonConversion<List<string>>();
modelBuilder.Entity<Document>().Property(item => item.Tags).HasJsonConversion<List<string>>();
}
}