【发布时间】:2018-09-14 15:45:50
【问题描述】:
Entity Framework Core 空对象。我有一对一的实体关系。
public class Player
{
public int Id { get; set; }
public int? RatingId { get; set; }
public Rating Rating { get; set; }
}
public class Rating
{
public double Mean { get; set; }
}
在我的播放器控制器中我返回
var player = await _context.Player.FindAsync(id);
不过这是我的 json
{
"id": 3010,
"ratingId": 2009,
"rating": null,
"displayName": "Conor",
"partialPlayPercentage": 0.5,
"partialUpdatePercentage": 1
}
这里的评分应该为空吗?
FTI 当我打电话时
var rating = await _context.Rating.FindAsync(2009);
我得到了正确的评价
【问题讨论】:
标签: c# model null entity-framework-6 entity-framework-core