我正在使用 ASP.NET MVC3。我有一个模型,它有一个我不想存储在数据库中的属性。是否有一个属性可以放在属性上以实现这一目标?谢谢。
最佳答案
public class Person
{
[Key]
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
[NotMapped]
public string FullName { get; set; }
}
该属性在命名空间
System.ComponentModel.DataAnnotations
中
关于asp.net-mvc-3 - MVC3 : Attribute for not mapping a property to a DB column,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7248718/