如何在运行时从nhibernate映射文件生成实体类 [英] How to generate entity classes from nhibernate mapping files during runtime

查看:103
本文介绍了如何在运行时从nhibernate映射文件生成实体类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有关c#和nhibernate的帮助. 我正在一个需要在运行时从hbm文件生成实体类的项目中. 我从服务获取映射文件,然后需要动态生成类并配置nhibernate以使用它们.

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.

问题在于我是nhibernate的新手,并且不是C#中的专家,因此我编写实现这一目标的代码很容易出错.

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 ?

谢谢丹尼斯.

推荐答案

这是一项不平凡的任务.您可以查看 hbm2net 项目,但是它仍然处于Alpha状态,我不知道它是否可以轻松地让您在运行时进行操作.

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.

您还应该查看 NHibernate工作台项目,它似乎正在执行与您正在执行的操作类似的操作.

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

这篇关于如何在运行时从nhibernate映射文件生成实体类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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