我正在尝试从我的Entity Framework linq查询中创建新对象,但是我收到的错误将在下面与我的代码一起显示。
var dashboards = await Db.Dashboards
.Select(dashboard => new DashboardViewModel
{
DashboardID = dashboard.DashboardID,
DashName = dashboard.DashName,
Shared = dashboard.Shared,
GlobalRefreshCycle = dashboard.GlobalRefreshCycle,
widgets = null
}).ToListAsync();
这是我的错误:
无法创建类型的null常量值。在此上下文中仅支持实体类型,枚举类型或基元类型