With automatically generated classes Net ORM solution: subsonic, Castle AR?
I used to use custom data mapping libraries, and I'm trying to switch to a broader ORM solution
After some experiments, I refined my requirements to the following points:
>Be able to generate available classes from database schema (SQL Server support is sufficient), > support activerecord schema, > programmatically configurable (through code or attributes, no HBM file), > free
Can you recommend one?
So far, I have tried:
Subsonic 3.0
My favorite one, because it feels like a good balance between function and simplicity
What I don't like:
>Use iqueryable < > and plural names at both ends of a one to many relationship – this seems counterintuitive to me; > Generate a file for all classes - for example, 1000 lines for each class. I don't feel good about the size of the code file; > T4 processing is called automatically, so the database with the latest schema must always be provided
Castle ActiveRecord
Castlear with activewriter add-on is almost what I need, but the activewriter code is not perfect (it seems that the nullable < > attribute is not supported, and the default one to many implementation does not work), and I can't find how to repair this code manually
Darkside generator Studio produces better code - correctly defined, one file per entity - although it uses mysterious names, such as refclassidrefclass I personally prefer studio addin to standalone applications, but this must be a small problem
About 20 files are bundled in the castle ar distribution; Although it's not a problem in itself, it feels like overweight Don't I need much esoteric knowledge about NHibernate and other things?
Fluent NHibernate
Widely recommended, but I can't find its code generator
Did I miss something important?
Solution
Some thoughts about your dislike of subsonic:
>Using iqueryable < > and plural names at both ends of a one to many relationship - seems counterintuitive to me;
Yes, I agree it's very intuitive. I've never delved into why, but you can easily modify the template to solve this problem
>Generate a file for all classes - for example, 1000 lines for each class. I don't feel good about the size of the code file;
You think this may cause problems, but I haven't encountered any problems, and I haven't seen the report on stack overflow
>T4 processing is called automatically, so the database with the latest schema must always be provided
It is called automatically only when you edit the T4 file, so when you make changes to the template, you actually only need the latest schema