2012-07-19 68 views

回答

2

你可以使用流利的API映射做到這一點上你的數據庫方面:

protected override void OnModelCreating(DbModelBuilder modelBuilder) { 
    modelBuilder.Entity<User>().Ignore(q => q.FullName); 
} 

或做拉斐爾並將NotMapped屬性添加到您的實體屬性中:

public class User { 
    public string FirstName { get; set; } 
    public string LastName { get; set; } 

    [NotMapped] 
    public string FullName { 
     get { 
      return string.Format("{0} {1}", FirstName, LastName); 
     } 
    } 
相關問題