开发者

Alternatives for NHibernate mappings?

开发者 https://www.devze.com 2022-12-18 01:29 出处:网络
Are there any good alternative to NHibernate\'s xml mappings? I have seen Fluent. All I look for is high maintainability.

Are there any good alternative to NHibernate's xml mappings?

I have seen Fluent. All I look for is high maintainability.

UPDATE : I would like to know the performance issues related with using flu开发者_运维知识库ent because I guess it is going to create xml mappings from the class (which can be time consuming - my guess)

Thanks


Fluent, but then again I would say that.

There's a minor performance impact by using it, but it's got nothing to do with XML generation*. NHibernate has a start-up time of it's own, and fluent only adds a fraction onto that; it's not even worth thinking about unless you're throwing around thousands of mappings (and more specifically, assemblies).

* Fluent's performance impact is actually from calling Assembly.GetTypes() to find any mappings in your assemblies.


I have seen Fluent..

Then go for it!

Fluent is a great alternative. I use NHibernate with Fluent, and it has been working out very well. I find the Fluent Configuration being much more maintainable and nicer than default NHibernate configuration.

Check out the Fluent Wiki - great documentation and a good starting point.

Regarding your edit I can't give you any concrete answers, but I have never seen any performance issues using Fluent myself. I assume NHibernate alone would be slightly faster on startup, but once the mappings are made there should be no difference. Also note that the performance in writing the code will be better due to the simplicity Fluent offers ahead of NHibernate configuration.


I used Linq To XSD to generate a class library from the mapping file xsd definition which gives you statically typed mappings, which you can write helpers and conventions for. The nice thing about it is that the syntax looks very similar to a normal hbm.xml file, while I haven't had the time to learn how to do each mapping in Fluent.


Other options are ActiveRecord and NHibernate.Mapping.Attributes

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号