您可以将Fluent NHibernate和Traditional hbm.xml混合使用吗 [英] Can you mix Fluent NHibernate and Traditional hbm.xml

查看:83
本文介绍了您可以将Fluent NHibernate和Traditional hbm.xml混合使用吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经在hbm.xml中完成了一些映射,我宁愿不必以编程方式映射这些映射,您是否可以在同一sessionfactory中将它们混合使用,直到我们有时间偿还债务为止?

We have some mapping already done in hbm.xml and I'd rather not have to map these programatically can you mix them in same sessionfactory until we have the time to repay the debt?

推荐答案

是的.

混合它们绝对是可能的.我正在我当前的项目中做.

It is absolutely possible to mix them. I'm doing it on my current project.

我的SessionFactory构造看起来像这样:

My SessionFactory construction looks something like this:

        _configuration = new Configuration();
        _configuration.SetProperties(properties);

        // hbm files
        _configuration.AddAssembly(typeof(ISurveyTask).Assembly);

...

        var persistenceModel = new PersistenceModel(...)

        // fluent mappings
        persistenceModel.addMappingsFromAssembly(typeof(ISurveyTask).Assembly);
        persistenceModel.Configure(_configuration);

享受:-)

这篇关于您可以将Fluent NHibernate和Traditional hbm.xml混合使用吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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