实体框架7包括()订单

asp.net-core-mvc entity-framework-core

在MVC6 / EF7中,如果订单存在差异,我会使用Include()将导航属性包含到查询中吗?

此查询有效

var vt = await db.VehicleTypes
            .Include(t => t.Photos)
            .Include(t => t.VehicleModels)
            .ThenInclude(m => m.Units)
            .Include(t => t.Rates)
            .ThenInclude(r => r.DailyPrice.Currency)
            .ToListAsync()

但是此查询在ToListAsync()处抛出异常

var vt = await db.VehicleTypes
            .Include(t => t.Photos)
            .Include(t => t.Rates)
            .ThenInclude(r => r.DailyPrice.Currency)
            .Include(t => t.VehicleModels)
            .ThenInclude(m => m.Units)
            .ToListAsync()

错误是

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

参数名称:index

我理解它是Beta,可能有bug。在这种情况下 - 它是一个错误还是一个设计的行为?

热门答案

看起来像一个bug;订单无关紧要。你介意创造一个问题吗?



Related

许可下: CC-BY-SA with attribution
不隶属于 Stack Overflow
这个KB合法吗? 是的,了解原因
许可下: CC-BY-SA with attribution
不隶属于 Stack Overflow
这个KB合法吗? 是的,了解原因