How to generate entity classes from nhibernate mapping files during runtime

怎甘沉沦 提交于 2019-12-24 16:20:28

问题


i need some help with c# and nhibernate. I'm working on a project that requires the entity classes to be generated from hbm files at runtime. I get the mapping files from a service, and then need to generate the classes dynamicaly and configure nhibernate to use them.

The problem is that i'm new to nhibernate and not much of a pro in c#, so me writing the piece of code that achieves this is very error-prone.

I was wondering if you know of any open source software that i could use. Worst case scenario (if can't find anything that even remotely resembles what i need), do you guys have some advice on where should i start? Maybe some links ?

Thanks, Denis.


回答1:


This is a fairly non-trivial task. There's the hbm2net project you could take a look at, but it's still in alpha and I don't know if it would easily let you do it at runtime.

You should also take a look at the NHibernate Workbench project, it seems to be doing something similar to what you're doing.



来源:https://stackoverflow.com/questions/2892431/how-to-generate-entity-classes-from-nhibernate-mapping-files-during-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!