如何从 Linq.Table获取 ColumnAttributes?
我正在尝试从 DataContext 返回列的属性。
如何提取 ColumnAttribute 元数据?
public class MyDataContext : DataContext
{
public Table<User> User;
public MyDataContext(string connection) : base(connection) { }
}
[Table(Name = "User")]
public class User
{
[Column(IsPrimaryKey = true)]
public long ID;
[Column]
public string FirstName;
[Column(CanBeNull=false)]
public string LastName;
int VersionNumber = 1000;
}
如何访问 User 对象或 Table
对象以获取有关列的元数据(IsPrimaryKey、CanBeNull 等)?
提前致谢。还在学习中...
I'm trying to return attributes of columns from my DataContext.
How can I pull out the ColumnAttribute meta data?
public class MyDataContext : DataContext
{
public Table<User> User;
public MyDataContext(string connection) : base(connection) { }
}
[Table(Name = "User")]
public class User
{
[Column(IsPrimaryKey = true)]
public long ID;
[Column]
public string FirstName;
[Column(CanBeNull=false)]
public string LastName;
int VersionNumber = 1000;
}
How do I access the User object or Table<User>
object to get the MetaData (IsPrimaryKey, CanBeNull, etc.) about the columns?
Thanks in advance. Still learning...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从那里,您可以获取各种内容。
From there, you can get to all kinds of stuff.