var type = typeof(T);
var property = type.GetProperty(columnSelectName);
var parameter = Expression.Parameter(type, "p");
var propertyAccess = Expression.MakeMemberAccess(parameter, property);
var orderByExp = Expression.Lambda(propertyAccess, parameter);
if (dataGridView.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection != SortOrder.Ascending)
{
MethodCallExpression resultExp = Expression.Call(typeof(Queryable), "OrderBy", new Type[] { type, property.PropertyType }, data.Expression, Expression.Quote(orderByExp));
bindingSource.DataSource = data.Provider.CreateQuery<T>(resultExp);
dataGridView.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = SortOrder.Ascending;
}
public partial class Logs
{
public string UserName
{
get
{
if (this.id_user.HasValue)
return this.Users.login;
else
return string.Empty;
}
}
public string TypeName
{
get
{
TypeLogs typeLogs = (TypeLogs)this.type;
switch (typeLogs)
{
case TypeLogs.LogOn:
return "Logowanie";
case TypeLogs.LogOff:
return "Wylogowanie";
case TypeLogs.LogOnFailed:
return "Nieudane logowanie";
case TypeLogs.LogsDelete:
return "Usunięto logi";
default:
return string.Empty;
}
}
}
LINQ to Entities 不支持指定的类型成员“成员”。仅支持初始化程序、实体成员和实体导航属性。
LINQ to Entities 不支持指定的类型成员“成员”。仅支持初始化程序、实体成员和实体导航属性。