小编yov*_*ayz的帖子

实体框架 - 创建新子(多个)时重复父(一个)

因为我的英语不好,我直截了当.为何记录公司在数据库中创建新记录和客户记录是否参考新公司记录?感谢帮助 :)

public class Company : EntityBase
{
    public string Name { get; set; }

    public List<Customer> Customers { get; set; }
    public List<Invoice> Invoices { get; set; }
}

public class Customer : EntityBase
{
    public string Name { get; set; }

    public Company Company { get; set; }
    public List<Card> Cards { get; set; }
}

public class EFRepositoryBase<TEntity> where TEntity : class, IEntity, new()
{
    protected IUnitOfWork UnitOfWork { get; set; }

    protected BenzineFleetContext Context
    {
        get …
Run Code Online (Sandbox Code Playgroud)

entity-framework

8
推荐指数
1
解决办法
3667
查看次数

标签 统计

entity-framework ×1