entity-framework-6 - 在 EntityFramwork 6.2.0 我想创建阴影属性(是 EF 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 支持影子属性。
解决方案
推荐阅读
- javascript - 如何在不知道原始类型的情况下将缓冲区转换为字符串/数字/日期
- javascript - 反应导航抽屉多次更新
- components - 将查询从 index.js 移动到 GatsbyJS 中的组件后,无法读取未定义的属性 'allContentfulBlogPost'(使用 Contenful 和 GraphQL)
- mysql - 过滤 MySQL 中的每一列
- r - 通过忽略 NA 值来获取列(或向量)中连续值之间的差异
- r - 根据条件按时间序列运行计数记录
- angular - 将动态创建的组件注入动态创建的树形图中
- vba - MSGBOX 在订单点击时无法正常工作
- angular - 在 Angular 中的父组件和子组件之间检查后,表达式发生了变化
- javascript - 标签未显示在 Force Visualization 上