我正在尝试使用 EF-Core 将一个引用其他对象的对象添加到我的数据库中。这是我的两个模型:
public class Contact : Entity
{
#nullable enable
public string? Name1 { get; set; }
public string? Name2 { get; set; }
public Company? Company { get; set; }
public string? Salutation { get; set; }
public string? Title { get; set; }
public DateTime? Birthday { get; set; }
public string? Address { get; set; }
public string? Postcode { get; set; }
public string? City { get; set; }
public string? Country { get; set; …Run Code Online (Sandbox Code Playgroud)