我有一个 DB - ScoreDB 和表 - ScoreTable 属性名称和分数。我想按降序显示分数:
t = from ScoreTable s in scoreDB.ScoreTable
orderby s.Score descending
select s;
行错误:
GameScoreCollection = new ObservableCollection<ScoreTable>(t);
«成员 'BrainGainWP.ScoreTable.Score' 不支持 SQL 转换。»。但是,如果所有工作的订单名称:
t = from ScoreTable s in scoreDB.ScoreTable
orderby s.Name descending
select s;
表代码:
[Table]
public class ScoreTable : INotifyPropertyChanged, INotifyPropertyChanging
{
[Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
}
private string _Name;
[Column]
public string Name
{
get
{
return _Name;
}
set
{
if (_Name != value)
{
NotifyPropertyChanging("Name");
_Name = value;
NotifyPropertyChanged("Name");
}
}
}
[Column]
private int _Score;
public int Score
{
get
{
return _Score;
}
set
{
if (_Score != value)
{
NotifyPropertyChanging("Score");
_Score = value;
NotifyPropertyChanged("Score");
}
}
}