1
嗨我有一個Linq的大問題。我必須做這兩個類中的0 .1一對一的關聯:Linq 0..1-one協會
[Table(Name = "TB_Points")]
public class Point
{
private int _ID = 0;
[Column(Storage = "_ID", DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
public int ID { get { return this._ID; } }
}
[Table(Name = "TB_TimePoint")]
public class TimePoint
{
private int _ID = 0;
[Column(Storage = "_ID", DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
public int ID { get { return this._ID; } }
//here is the association
public Point Pos { get; set; }
}
點是我的一般類,所以有時一個點可以不存在的時間點,所以在那裏爲null該協會。而且我不需要知道Point類中的TimePoint。 我所有的嘗試都失敗了。我不知道問題是在IsDbGenerated = true還是其他東西。請幫忙。 Thx