Моя исходная таблица (PriceCostRules
) может объединяться в одну и только одну из двух таблиц. Поэтому пытаюсь сделать что-то вроде ниже, но получаю ошибку: Cannot compare elements of type 'System.Collections.Generic.ICollection. Only primitive types, enumeration types and entity types are supported.
Я также попытался проверить .Any()
вместо null
. Но это дает ошибку nested query not supported
.
Есть ли способ сделать это? Могут ли условия быть использованы каким-либо образом?
public class ItemPriceCostRulesViewModel
{
.... other simple properties ....
public IEnumerable<ItemPriceCostRuleDatesViewModel> AfffectedItems { get; set; }
}
.ForMember(vm => vm.AfffectedItems, opt => opt.MapFrom(entity =>
entity.Items_CostRule != null ? entity.Items_CostRule
: entity.Items_PriceRule != null ? entity.Items_PriceRule : null
))