【发布时间】:2021-10-24 02:59:21
【问题描述】:
嗨
我有两张桌子
1.应用用户
2.销售
如何使用 Fluent API 在 DataContext.cs 类中配置一对多关系
从 AppUser 表 ID 到销售表用户 ID
继承自 IdentityUser 的 AppUser 表类
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;
namespace Domain
{
public class AppUser : IdentityUser
{
public string DisplayName { get; set; }
public string Bio { get; set; }
}
}
销售表类
namespace Domain
{
public class Sale
{
public int SaleID { get; set; }
public int SaleAmount { get; set; }
public int UserID { get; set; }
}
}
谢谢。
【问题讨论】:
标签: c# entity-framework .net-core entity-framework-core ef-fluent-api