NHibernate映射属性vs流利的NHibernate [英] NHibernate mapping attributes vs fluent NHibernate

查看:160
本文介绍了NHibernate映射属性vs流利的NHibernate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

映射属性与nhib hbm的功能相同吗?你可以把它们和FNH一起用来处理一些事情吗?FNH还没有和HBM一样好?



干杯,

Berryl



通过映射属性,我不是指hbm文件;有很明显的NHib(或者NHib contrib这些天),你用来装饰你的班级属性,类属性。我猜这些过期的FNH,但不知道。

解决方案

我个人更喜欢自己创建hbm.xml文件。我已经使用过Fluent,但是我只是喜欢像这样管理自己的事情。然而,我没有遇到任何映射,我一直无法与流利的工作,虽然...



这是我的理解,流利nHibernate实际上创建hbm.xml文件在后台基于你的设置,反过来由nHibernate使用...因此,流利自己创建映射,我会争辩说,只是手动创建hbm.xml会在技术上给你更多的灵活性和访问对映射文件的细微差别... ...

我认为两者都有类似的学习曲线,所以如果你打算学习Fluent本身创建hbm .xml文件,为什么不学习如何自己创建该死的hbm.xml文件,并跳过中间人!



除非你做了很多项目快速连续地,实际映射你的数据库的行为只是你在一个特定项目上所做的实际工作的一个片段。




  • 最大值Schilling

  • l>

    Do mapping attributes offer the same versatility as nhib hbm's do? Can you use them together with FNH to handle things FNH doesn't yet do as well as hbm's can?

    Cheers,
    Berryl

    By mapping attributes, I don't mean hbm files; there are apparently attributes that come with NHib (or maybe NHib contrib these days) that you use to decorate your class & class properties. I'm guessing these pre-date FNH, but not sure.

    解决方案

    I personally prefer to create the hbm.xml files myself. I've used Fluent, but I just like managing the nitty gritty myself for things like this. However I've not run into any mappings that I haven't been able to get working with Fluent though...

    It is my understanding that Fluent nHibernate actually creates an hbm.xml file in the background based on your settings that is in turn used by nHibernate... so being that Fluent is itself creating the mappings, I would argue that just creating the hbm.xml manually would technically give you more flexibility and access to the nuance of the mapping file...

    I think that there is a similar learning curve for both, so if you are going to bother learning Fluent that itself creates hbm.xml files, why not just learn how to create the damn hbm.xml files yourself in the first place and skip the middle man!

    Unless you are doing MANY MANY projects in rapid succession, the act of actually mapping your database is only a fragment of the actual work you are doing on a particular project.

    • Max Schilling

    这篇关于NHibernate映射属性vs流利的NHibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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