У меня есть класс, который расширяет элемент управления System.Web.UI.WebControls.GridView.
Я хочу иметь свойство, которое может сохранить мое выражение EF для использования во всем элементе управления.
Проблема в том, что T не определено.
public sealed class NCGridView : GridView
{
private Expression<Func<T, bool>> _where;
public void LoadWhere(Expression<Func<T, bool>> where)
{
_where = where;
}
}
Попытка предложения RedHat
private Expression<Func<BaseModel, bool>> _where;
public void LoadWhere<T>(Expression<Func<T, bool>> where) where T : BaseModel
{
// Cannot cast from: Expression<Func<T, bool>> to: Expression<Func<BaseModel, bool>>
_where = where;
}