开发者

How to get class mapping information at runtime in Nhibernate?

开发者 https://www.devze.com 2023-02-04 06:27 出处:网络
Where does NHibernate store mapping information at runtime and how to access it? I need to get association properties (complex properties) for a given mapped class at runtime. And i can\'开发者_运维知

Where does NHibernate store mapping information at runtime and how to access it? I need to get association properties (complex properties) for a given mapped class at runtime. And i can'开发者_运维知识库t rely on reading hbm files because, mapping can be done in fluent nhibernate.


Yes. You can use ISessionFactory.GetClassMetadata to get a metadata object for each persistant type.

http://www.nudoq.org/#!/Packages/NHibernate/NHibernate/ISessionFactory/M/GetClassMetadata


You can get it using the NHibernate.Cfg.Configuration.GetClassMapping which I found is more detailed than the NHibernate.ISessionFactory.GetClassMetadata.

http://www.nudoq.org/#!/Packages/NHibernate/NHibernate/Configuration/M/GetClassMapping

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号