在EntityFramwork 6.2.0中,我想创建阴影属性(是EF 6支持阴影属性)

时间:2018-10-29 13:22:25

标签: entity-framework-6

我的实体是

class Student
{
    public long Id{ get; set; }
}

数据库上下文是

 public class StudentContext:DbContext
 {
     public StudentContext():base("name=cnName") {}

     public DbSet<Student> Student{ get; set; }

     protected override void OnModelCreating(DbModelBuilder modelBuilder)
     { 
         modelBuilder.Entity<Student>().Property<DateTime> 
                                                ("CreatedOn");
         base.OnModelCreating(modelBuilder);
     }
}

例外是

  

语法错误无法从字符串转换为System.Linq.Expressions.Expression

在行

下方

modelBuilder.Entity<Student>().Property<DateTime>("CreatedOn");

我做错了是实体6支持阴影属性。

0 个答案:

没有答案
相关问题