私のテーブルPersonsには、という名前の生年月日列がありますDOB。
私の dbml ファイルに、singleという名前の追加のプロパティを追加しましたAge。
AgeLinq クエリで、今日の ad から計算された年齢を返すにはどうすればよいDOBですか? つまり、以下の架空のコードのようなものを実現するにはどうすればよいですか。
DataClasses1 db = new DataClasses1();
var pp = from p in db.Persons
select new Person()
{
Name = p.Name, // ... clone all the other properties ...
Age = (DateTime.Today-p.DOB).Days/365
}
同じ目的を達成する別の方法はありますか?
ありがとう。