I have a EF model where it has the following property:
public Uri? LinkedIn { get; set; }
In my IEntityTypeConfiguration.Configure I have:
builder.Property(e => e.LinkedIn).HasConversion(v => v.ToString(), v => new Uri(v));
I get a warning that the v in the v.ToString() might be null. But if I change it to:
builder.Property(e => e.LinkedIn).HasConversion(v => v?.ToString(), v => new Uri(v));
I get an error saying I can't have a null check in a lambda operator. I've tried parens, and explicit check, etc and it's unhappy with all of them.
Now can I do this? This is in EntityFramework Core but I think that's irrelevant to this question.