如何在EF 4.3代码中首先映射受保护的属性 [英] How to map a protected property in EF 4.3 code first

查看:87
本文介绍了如何在EF 4.3代码中首先映射受保护的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在EF 4.3文档中说:

In EF 4.3 documentation says:


默认情况下,使用Code First构建数据库不包括私有,受保护或内部属性。如果手动将这些属性包含在模型中,Code First将忽略这些成员的任何数据注释。这是现在已经解决的问题,而Code First处理数据注释。

By default, building a database using Code First does not include private, protected, or internal properties. If you manually included these properties in your model, Code First would ignore any data annotations on those members. This is issue now fixed, and Code First processes the data annotations.

我的问题是如何在代码中包含受保护的属性manully ,特别是使用流畅的API?

My question is how to included a protected property manully with code first, espically using fluent API?

推荐答案

查看 http://blog.cincura.net/232147-mapping-private-or-protected-properties-with-code-first- efv4-ctp4 / 来自 Drew Jones 的评论。不完全干净,但至少有东西。 :)

Look at http://blog.cincura.net/232147-mapping-private-or-protected-properties-with-code-first-efv4-ctp4/ to the comment from Drew Jones. Not entirely clean, but at least something. :)

或直接 http://blog.cincura.net/232731-mapping-private-protected-properties-in-entity-framework-4-x-code-first/

这篇关于如何在EF 4.3代码中首先映射受保护的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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