如何在查询中动态添加 OR 条件。使用 EF5.0、LINQ、MVC4.0 和存储库模式编写代码。
public ActionResult Index()
{
var model = new AssignedSearchFields(); //ViewModel
List<LClient.Model.Attribute> allFields = Common.GetAssignedSearchFields(User.Identity.Name, userID, "EntityType Name 1");
model.SearchFields = allFields; // List allFields having dynamic number of items.
model.Entities = entityRepository.GetMany(e => e.EntityTypeID == 1 && e.InstanceID <= 10 && (e.AttributeID == 1 || e.AttributeID == 2 || e.AttributeID == 3 || e.AttributeID == 4)); // Here I want to use AttributeID dynamically without OR conditions.
return View(model);
}