如何停止EF 7将实体属性映射到列? [英] How can I stop EF 7 mapping an entity property to a column?

查看:90
本文介绍了如何停止EF 7将实体属性映射到列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在EF 6中,我可以向该属性添加一个 NotMapped 属性,这样就不会将其映射到列。如何在EF 7中执行此操作?

In EF 6, I can add a NotMapped attribute to the property, then it will not be mapped to a column. How can I do this in EF 7?

推荐答案

我们尚未实现数据注释。 (请参见#107 。)您应该可以使用Fluent API来做到这一点。

We haven't implemented data annotations yet. (See #107) You should be able to do it using the Fluent API.

modelBuilder.Entity<MyEntity>().Ignore(e => e.NotMappedProperty);

这篇关于如何停止EF 7将实体属性映射到列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆