This project is read-only.

Suggested New Code Generated Files


Attached is a proposed way of generating DomainServices from an .edmx file.
For this to work, you need to download T4Toolbox:
This is a VERY simple solution with MINIMAL testing, but it does the following (think, happy path :)):
  • Goes through the project the .tt file is in, and resolves all the .edmx files.
  • Creates a DomainService for each container within the edmx file (usually should only be one, have not tested other scenarios).
  • For each entity, a IEntityProvider is created for basic CRUD operations.
  • For each entity a I_EntityName_Service interface is created and is implemented on the DomainService
  • For each entity service, the DomainService properly implements all operations. The default implementation is to funnel the calls through the provider.
  • A "Register" method is created on the DomainService to register custom providers, if necessary.
    So in short, a GodService is created with interfaces (in case you need to carry them over the wire to the client). Every method that is created on the GodService is tunneled through to a given provider. The default provider is exactly what you would expect (what you see in the demos).
    You can take an existing default provider and extend it and do what you will (security checks or additional business logic). In the tests I simply throw an exception to show how it's done.
    Anyways, this has been a good learning experience w/ T4 (my first) and a good framework going forward to get around the nastiness that this thread deals with (introduced in the July Preview):

file attachments


icnocop wrote Jun 28, 2011 at 2:41 AM

Thanks, this is a good start.
However, I noticed that this needs to be updated for the latest version of t4 toolbox:
  1. replace all the "protected override void RenderCore()" in the Templates to: "public override string TransformText()"
  2. append "return this.GenerationEnvironment.ToString();" at the end of "public override string TransformText()" method
  3. delete