The application I am currently building has been using Stored procedures and hand-crafted class models to represent database objects. Some people have suggested using Entity Framework and I am considering switching to that since I am not that far into the project. My problem is, I feel the people arguing for EF are only telling me the good side of things, not the bad side :)
My main concerns are:
- We want Client-Side validation using DataAnnotations, and it sounds like I have to create the client-side models anyways so I am not sure that EF would save that much coding time
- We would like to keep the classes as small as possible when going over the network, and I have read that using EF often includes extra data that is not needed
- We have a complex database layer which crosses multiple databases, and I am not sure EF can handle this. We have one Common database with things like Users, StatusCodes, Types, etc and multiple instances of our main databases for different instances of the application. SELECT queries can and will query across all instances of the databases, however users can only modify objects that are in the database they are currently working on. They can switch databases without reloading the application.
- Object modes are very complex and there are often quite a few joins involved
Arguments for EF are:
- Concurrency. I wouldn't have to code in checks to see if the record was updated before each save
- Code Generation. EF can generate partial class models and POCOs for me, however I am not positive this would really save me that much time since I think we would still need to create the client-side models for validation and some custom parsing methods.
- Speed of development since we wouldn't need to create the CRUD stored procedures for every database object
Our current architecture consists of a WPF Service which handles database calls via parameterized Stored Procedures, POCO objects that go to/from the WCF service and the WPF client, and the WPF desktop client itself which transforms POCOs into class Models for the purpose of Validation and DataBinding.
So my question is, is EF right for this? Are there any pitfalls about EF that I am unaware of?