Partial-selection and auto-mapping for DTOs
I've read the post http://blogs.msdn.com/b/adonet/archive/2011/01/30/using-dbcontext-in-ef-feature-ctp5-part-5-working-with-property-values.aspx, it's beautiful, and I have some additional requests:
1) I should be able to decorate some properties in my DTOs so it can have a different name (or decorate them at runtime with type-description).
2) Should be able to select partial queries:
- Via property selectors (both typed and strings) via DTO initializers
- Via constructor of another class (in EF4 this is not allowed) I mean .Select(u=> new FatUnicorn(u.Id, u.CornLength));
- As per the previous example, should also be: context.Unicorns.Select<UnicornSummary> using the method of assigning matching property names or decorated with attributes as above, the type argument here obviously has to be limited with 'new()' it will automatically create a summary DTO signed with selected values from the original type - UnicornSummary contains only some of the fields from the original Unicorn
- A matching context.Unicorns.Select(typeof(UnicorSummary));
Support for partial entities for Insert, Update and delete operations
Also should be able to select using a method, there should be a runtime-method cache when generating SQL syntax, so I should be able to use
context.Unicorns.Select(u=>UnicornFactory.Create(u.Id, u.Myths)), the factory is supposed to return an unknown type based on the parameters.
This has to be a two-parts query so the details of the SQL are extracted and sent to storage, then using the construction details.