小编tom*_*zzi的帖子

EF-Core 尝试插入已存在的关系数据

我正在尝试使用 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)

c# entity-framework asp.net-core

5
推荐指数
1
解决办法
2218
查看次数

标签 统计

asp.net-core ×1

c# ×1

entity-framework ×1