Iam using .NET 3.5. I have asp.net mvc app. There is base controller:
public abstract class BackendController<TModel> : BaseController where TModel : class
{
// skipped ...
public ActionResult BatchDelete(int[] ids)
{
var entities = repository.GetList().Where(item => ids.Contains(item.ID));
repository.delete(entities)
}
public ActionResult BatchHide(int[] ids)
{
var entities = repository.GetList().Where(item => ids.Contains(item.ID));
repository.BatchUpdate(
entities.Where(item => item.IsHidden == false),
c => new TModel { IsHidden = true }
);
}
}
It is won’t compile, because of item.ID and item.IsHidden - but in runtime this is valid type with certain properties. How to make this compile?