NHibernate映射最有效的方法是什么? [英] What's the most productive way to do NHibernate mapping?

查看:159
本文介绍了NHibernate映射最有效的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在Java中使用Hibernate映射的注释,现在正在寻找类似的方法来在C#和NHibernate中做相同的工作。我发现有几种方法可以在xml文件中映射
$ b $ ul

  • NHibernate.Mapping .Attributes(NHMA)

  • Fluent

  • 还有更多吗?



  • 我尝试了NHMA,发现它有一些封锁点给我...



    我不想让你讨论,最好的方式来映射模型到NHibernate,但我正在寻找一个比较好的互联网。



    你知道这样的网站吗?如果我选择上面列出的框架之一,哪些事实需要考虑?我正在考虑NH开发人员支持这个项目吗?,有没有可以用xml-mapping进行映射的模型,而是流利/ NHMA /等等的模型?。



    您可以推荐些什么?
    为什么?

    解决方案

    流畅的NHibnernate自动映射或代码生成(CodeSmith,MyGeneration,T4等)是创建映射文件最有效的方法。我不喜欢属性的方法,因为我喜欢保持我的POCO的简单。


    I know annotations to do the hibernate mapping in Java and am looking now for a similar way to do the same in C# and NHibernate. I found out that there exists several approaches

    • do the mapping in xml files
    • NHibernate.Mapping.Attributes (NHMA)
    • Fluent
    • are there any more??

    I tried NHMA and found out it had some blocking points for me...

    I don't want you to discuss, whats the best way to map models to NHibernate, but I was looking for a good comparison on the internet.

    Do you know such sites? What facts are the main points to consider, if I choose one of the "frameworks" listed above? I'm thinking of aspects like 'is this project offically supported by the NH-Developers?', 'are there models that can be mapped in xml-mapping but not in fluent/NHMA/etc...?'

    What can you recommend? Why?

    解决方案

    Fluent NHibnernate auto mapping or code generation (CodeSmith, MyGeneration, T4, etc.) are the most productive ways to create the mapping files. I dislike the attributes approach because I like to keep my POCOs plain.

    这篇关于NHibernate映射最有效的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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