So... why I don't like DataSets? Well, first of all, it is not that I think that DataSets are useless, it is just that I feel that Object Relational Mapping (ORM) is a far better solution, because, when properly built:
- You don't have to worry about primary keys of foreign keys (or the proprietary identity mechanism of a particular database)
- You don't have to worry about creating the master row first, and the detail rows later (master detail relationships are automatically handled by the ORM)
- You don't have to worry about saving all the changes in your data in the proper order(CRUD operations are automatically ordered following master detail relationships)
- You can easily add optimistic locking to you code without having to change all your SQL "UPDATE" or "DELETE" code.
- Your domain model is more abstracted from the idea that is being read from a database (a really good ORM should be able to read from a different relational source... or perhaps even a hierarchical source (Object Hierarchical Mapper?)... for example... from an XML file.
- You automatically get "cache" benefits, transparently, and sometimes you can even plug special caching strategies.
No comments:
Post a Comment