我正在尝试调试 DBContext 查询,生成的 SQL 如下所示
SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Name] AS [Name],
[Extent1].[SocialDetails_Id] AS [SocialDetails_Id]
FROM [dbo].[Items] AS [Extent1]
WHERE [Extent1].[Id] = @p__linq__0
但是,即使我检查了数据库中的 ID,外键属性 SocialDetails 也是空的
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
[Required]
public User User { get; set; }
[Required]
public SocialDetails SocialDetails { get; set; }
etc
找出为什么 SocialDetails 始终为空的最佳方法是什么?