I am evaluating Entity Framework for a project with an outdated database. The database is pretty well designed, and it has already been decided that we will use the Database-First approach. The application will be based on WinForms, but I would like to plan ahead and take ASP.Net into account, and it is also likely to be requested by management at some point, and I would like to reuse DAL.
Now I understand that the Entity Framework provides several ways to create entity objects:
- Objects Derived from EntityObject
- POCO (ObjectContext)
- POCO (DbContext)
- Self-Tracking Entities (STE)
I am trying to compare three approaches, and I have found out so far.
The EntityObject T4 template is the richest of all. For example, it places comments from the Entity model in XMLDoc comments on top of each class and each property of the object, which is quite nice and useful from the point of view of maintainability of the code. None of the other generators supports this out of the box (although I understand that it is possible to modify T4 templates, but this obviously requires some work). The DbContext API, on the other hand, is a bit nicer.
Derived EntityObject types provide an event that you can connect to when an object property changes, which is useful for implementing business logic.
, POCO , T4 , .
, POCO - , , , , , , , - ?
, , EntityObject, POCO, , , , EntotObjects , POCO.
POCO, -, , .
, ASP.Net? , ? - (, , )?
.