日期:2014-05-20 浏览次数:20817 次
这段程序不是很理解,请大家详细讲解一下
private EntitySet<Book> _user;
[Association(Storage = "_user", OtherKey = "username")]
public EntitySet<Book> Temp
{
set { this._user = value; }
get { return this._user; }
}
ID,UserName,passwordBook表有字段
UserName,Book对应的类的代码为:
public partial class Admin
{
public Admin()
{
}
//Column中的属性Name指定对应的列,IsPrimaryKey指定对应Admin表中的ID是否为主键,
[Column(Name = "ID", IsPrimaryKey = true)]
public int ID { get; set; }
[Column(Name = "UserName")]
public string UserName { get; set; }
[Column(Name = "password")]
public string PassWord { get; set; }
private EntitySet<Book> _user;
[Association(Storage = "_user", OtherKey = "username")]
public EntitySet<Book> Temp
{
set { this._user = value; }
get { return this._user; }
}
}
[Table(Name = "Book")]
public class Book
{
[Column(Name = "username", IsPrimaryKey = true)]
public string username { get; set; }
[Column(Name = "book")]
public string book { get; set; }
}