I am creating a reusable library using .NET Core (targeting .NETStandard 1.4) and I am using Entity Framework Core (and new to both). I have an entity class that looks like
Its simple
public class Person
{
[Required]
[MaxLength(50)]
public string FirstName { get; set; }
[Required]
[MaxLength(50)]
public string LastName { get; set; }
[Required]
public DateTime DateOfBirth { get; set; }
public string AddressesJson { get; set; } //save this json properity in table.
[NotMapped]
public List Addresses
{
get => !string.IsNullOrEmpty(AddressesJson) ? JsonConvert.DeserializeObject>(AddressesJson) : null;
}
}
public class Address
{
public string Type { get; set; }
public string Company { get; set; }
public string Number { get; set; }
public string Street { get; set; }
public string City { get; set; }
}