0
我有一個移動應用程序,我試圖利用windows phone數據庫。 但是我遇到了一個小問題。Linq to SQL多對多關係,使用集合
這是我到目前爲止。
[Table]
public class CollectionManager
{
[Column(IsPrimaryKey = true)]
public int FilmID { get; set; }
[Column(IsPrimaryKey = true)]
public int CollectionID { get; set; }
private EntityRef<FilmData> film;
[Association(ThisKey = "FilmID", OtherKey = "ID", Storage = "film")]
public FilmData Film{ get { return film.Entity; } set { film.Entity = value; } }
private EntityRef<Collection> collection;
[Association(ThisKey = "CollectionID", OtherKey = "ID", Storage = "collection")]
public Collection Collection { get { return collection.Entity; } set { collection.Entity = value; } }
}
[Table]
public class FilmData
{
[Column(IsPrimaryKey = true)]
public int FilmID { get; set; }
[Association(ThisKey = "ID", OtherKey = "FilmID")]
public EntitySet<CollectionManager> CollectionManager { get; set; }
}
[Table]
public class Collection
{
[Column(IsPrimaryKey = true)]
public int CollectionID { get; set; }
[Association(ThisKey = "ID", OtherKey = "CollectionID ")]
public EntitySet<CollectionManager> CollectionManager { get; set; }
}
因此,這些都是我的3個表,但是我很努力
- 電影添加到收藏
- 獲取集合中的所有影片。
我非常感謝任何幫助,非常感謝您花時間閱讀本文!