.NET的ORM解决方案类自动生成:亚音速,城堡AR,...? [英] .NET ORM solution with class auto-generation: Subsonic, Castle AR, ...?
问题描述
我使用一个自定义的数据映射库工作,并curently我想要切换到更wides $ P $垫ORM解决方案。
I used to work with a custom data mapping library, and curently I'm trying to switch to a more widespread ORM solution.
在一些实验,我改进我的要求如下:
After some experimentation, I refined my requirements to the following:
- 能够产生有用的类数据库架构(SQL Server支持就足够了),
- 的ActiveRecord的模式支持,
- programmaticaly配置(通过code或属性,无HBM文件),
- 免费的。
你能不能推荐一个?
到目前为止,我曾尝试:
So far I have tried:
亚音速3.0
一个我目前最喜欢的,因为它感觉像功能性和简单性之间的良好平衡。
The one I currently like most, as it feels like a good balance between functionality and simplicity.
我不喜欢的:
- 在使用的IQueryable<>以及多个名字中的一个一对多的关系两端 - 这似乎相当反直觉的我;
- 生成一个文件的所有类 - 像每类千行,我有大约code文件是一个不好的感觉,大的;
-
T4处理自动调用,所以最多最新的架构必须所有的时间可。 数据库
- uses IQueryable<> and plural names for both ends of one-to-many relationship - that seems rather counter-intuitive to me;
- generates one file for all classes - like a thousand lines per class, I have a bad feeling about code files being that large;
T4 processing is invoked automatically, so a database with up-to-date schema must be available all the time.
城堡的ActiveRecord
CastleAR与ActiveWriter外接几乎是我所需要的,但ActiveWriter的code是不完美的(现在看来,可空&LT;>不支持的属性,以及默认的一对多实现不工作)我找不到如何手动修复此code。
CastleAR with ActiveWriter add-in is almost what I need, but ActiveWriter's code isn't perfect (it seems, Nullable<> properties are not supported, and default one-to-many implementation doesn't work) and I couldn't find how to fix this code manually.
阴暗面GeneratorStudio产生更好的code - 正确的定义,每个实体中的一个文件 - 尽管它使用含义模糊的名称,如 RefclassIdRefclass 的。我个人喜欢Studio的插件超过独立的应用程序,但是这肯定是一个小问题。
Darkside GeneratorStudio produces better code - correct definitions, one file per entity - though it uses cryptic names like RefclassIdRefclass. Personally I like Studio addin more than standalone app, but this certainly is a minor issue.
目前是二十文件捆绑在CastleAR分布;虽然不是本身的问题,感觉就像超重。会不会我需要有关NHibernate和其他的东西太深奥的知识?
There're about twenty files bundled in the CastleAR distribution; though not a problem by itself, it feels like overweight. Won't I need too much esoteric knowledge about NHibernate and other stuff?
功能NHibernate
广泛推荐,但我没能找到一个code生成它。
Widely recommended, but I wasn't able to find a code generator for it.
我错过了一些重要的事情?
Have I missed something important?
推荐答案
上的东西的一些想法,你不喜欢亚音速:
A few thoughts on the things you don't like about SubSonic:
- 在使用的IQueryable&LT;>以及多个名称的两端一到多的关系 - 这似乎 而反直觉给我;
- uses IQueryable<> and plural names for both ends of one-to-many relationship - that seems rather counter-intuitive to me;
没错,我同意这是很直觉,我从来没有得到的,为什么是这样的底部,但你可以pretty的轻松修改模板来解决这个问题。
True, I agree this is very counter intuitive and I've never got to the bottom of why it is that way, but you can pretty easily modify the templates to fix this.
- 生成一个文件的所有类 - 像每类千行,我有大约code文件是一个不好的感觉,大的;
您会觉得这可能会造成问题,但我还没有遇到任何和我还没有看到一个国家报告的计算器。
You'd think this might cause problems but I've yet to come across any and I've yet to see one reported on stackoverflow.
- T4处理自动调用,所以用了最新架构的数据库必须是可用的所有时间。
这只是如果编辑T4文件那么真的是你只需要一个上最新架构可当你在更改模板自动调用。
It's only invoked automatically if you edit the t4 files so really you only need an up-to-date schema available when you're making changes to the templates.
这篇关于.NET的ORM解决方案类自动生成:亚音速,城堡AR,...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!