I’m having trouble choosing an appropriate data access framework, partly because I’m very picky with my preferences and mostly because I don’t have much experience with most of them 🙂
I need a framework that will allow me to easily map between the DB tables (SQL Server) and my entities, and that will handle the CRUD operations for me (for the most part).
- I want my entities to reside in a separate assembly from my DAL.
- I prefer using attributes for the mappings over external file like XML.
- It doesn’t have to be an ORM, and I want to code my entities myself.
- I don’t mind writing stored procedures.
- The project’s database won’t be very big. Less than 50 tables.
- I’d like some of my entities to correspond to an inner join of two tables – one for static data entered manually during development and the other with data filled during runtime – without using two entities that reference one another (the result of this join will be a single entity).
- Entity Framework sounded perfect until I realized it doesn’t support Enums (yet – and I can’t wait for EF 5.0).
- I want these entities to include Enums, and plan on using lookup tables for the enums + code generation for the enum to keep it synchronized with the database.
- Linq-to-SQL seems like a good candidate, but I don’t know if it copes well with my previous demands.
- Using Enterprise Library 5.0 DAAB with it’s RowMapper, and extending it’s abilities to perform updates and inserts is also an option (but will require more coding on my part).
- I plan on implementing the Repository Pattern.
- How about NHibernate? Would it do? No experience there either.
I would be happy to hear all suggestions.. the more the merrier! Thanks in advance!
I think nHibernate is the way to go, although some of its main strengths (ORM, stored procedure generation, etc) are things you listed as non-requirements. Anyway, nHibernate will do everything you want it to do. Technically it does use xml mappings, but these can easily be auto-generated using fluent attribute mapping. I like this, as it IS done for you, but you get the customization too just in case you need it. Good luck!