DB - ScoreDB とテーブル - プロパティ Name と Score を持つ 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");
}
}
}