How not persist property EF4 code first?
问题 How do I make non persisted properties using codefirst EF4? MS says there is a StoreIgnore Attribute, but I cannot find it. http://blogs.msdn.com/b/efdesign/archive/2010/03/30/data-annotations-in-the-entity-framework-and-code-first.aspx Is there a way to set this up using EntityConfiguration? 回答1: In EF Code-First CTP5, you can use the [NotMapped] annotation. using System.ComponentModel.DataAnnotations; public class Song { public int Id { get; set; } public string Title { get; set; }