ASP.NET MVC3 System.ComponentModel.DataAnnotations 和关联
这部分代码工作正常,
[Association(Storage = "profile", ThisKey = "UserId", OtherKey = "UserId")]
public Profile User {
get { return this.profile.Entity; }
set { this.profile.Entity = value; }
}
但如果我添加到此类中
System.ComponentModel.DataAnnotations
,则无法找到关联。
问题出在哪里?
This part of code works fine
[Association(Storage = "profile", ThisKey = "UserId", OtherKey = "UserId")]
public Profile User {
get { return this.profile.Entity; }
set { this.profile.Entity = value; }
}
but if i add in this class
System.ComponentModel.DataAnnotations
then, Association could not be found.
Where is the problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对 Austin 答案的增强是使用
using
语句:An enhancement to Austin's answer is to employ the
using
statement:看起来您有两个冲突的名称空间。尝试将 Association 更改为 System.Data.Linq.Mapping.Association,因此它看起来像:
It looks like you've got two namespaces that are conflicting. Try changing Association to System.Data.Linq.Mapping.Association, so it would look like: