使用流畅的 nhibernate,无论如何要映射私有属性 [英] using fluent nhibernate, is there anyway to have a private property mapped

查看:24
本文介绍了使用流畅的 nhibernate,无论如何要映射私有属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字段,我想在它链接到数据库中的列时映射该字段,但我不希望任何外部类直接从我的代码访问该字段(它仅用于私有计算).

i have a field that i want to map as it links to a column in the database but i don't want any external class to access this field directly from my code (its only used in private calculations).

这是否可能有一个我可以映射的字段,但使用 fluent nhibernate 将其私有化??

is this possible to have a field that i can map but it private using fluent nhibernate??

推荐答案

是的,这是可能的.您可以使用 Reveal.Member 静态方法来映射私有或隐藏属性

Yes it is possible. You can use the Reveal.Member static methods to map a private or hidden property

Map(Reveal.Member<string>("privateProperty"))

这篇关于使用流畅的 nhibernate,无论如何要映射私有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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