WCF Plain Service Templates

3 posts, 1 answers
  1. Kyle T.
    Kyle T. avatar
    16 posts
    Member since:
    Dec 2011

    Posted 13 Apr 2012 Link to this post

    Hi,

    We are using the DSW from OpenAccess ORM v2012.1.301.2 in Visual Sutdio 2010 SP1 to generate a WCF Plain Service and all is working well.  We would like to tweak to templates to perform a couple of manual steps so that the developers don't have to.  Here are the changes that we are wanting to do:
    • Add the Windows Authentication configuration to the web.config generated file
    • Switch the generated service interface files to be a partial interface so that our Domain Method code can be added to the service 
    • Add our internal data access security logic at the beginning of each of the Read/Create/Update/Delete calls
    • Add logic to the parameter names/types to deal generated names that collide with .NET System types and keywords so that we don't have to manually correct after each generation.

    I've tried editing the .TT files I thought were used to generate each file but not of my changes are showing up.  Can you verify that 1) I can make the changes outlined above in the .TT files that are on my local drive and 2) that the following list is the correct file mapping?

    • Assemblers.cs: C:\Program Files (x86)\Telerik\OpenAccess ORM\dsl2010\CodeGenerationTemplates\Dto\CSharp\Includes\Specific.ttinclude
    • I{ServiceName}Service.cs: C:\Program Files (x86)\Telerik\OpenAccess ORM\dsl2010\Extensibility\Dsw\Templates\CSharp\PlainIDataService.tt
    • {ServiceName}Service.svc: C:\Program Files (x86)\Telerik\OpenAccess ORM\dsl2010\Extensibility\Dsw\Templates\CSharp\PlainDataService.svc.tt
    • {ServiceName}Service.svc.cs: C:\Program Files (x86)\Telerik\OpenAccess ORM\dsl2010\Extensibility\Dsw\Templates\CSharp\PlainDataService.tt
    • Services.cs: C:\Program Files (x86)\Telerik\OpenAccess ORM\dsl2010\CodeGenerationTemplates\Dto\CSharp\Includes\Specific.ttinclude
    • web.config: C:\Program Files (x86)\Telerik\OpenAccess ORM\dsw\Templates\WCFEndPoint\vs2010\CSharp\WCFServiceConfiguraiton.t4

    Thanks,
    Kyle
  2. Answer
    Serge
    Admin
    Serge avatar
    375 posts

    Posted 18 Apr 2012 Link to this post

    Hello Kyle, 

     Yes, you are correct, most of the templates are correct with the exception of the web.config one. In the new Generate OpenAccess Domain Service wizard, we actually do not use a template for inserting the needed configurations into the web.config, but rather have them configured trough code. Unfortunately this means that you will not be able to use this.

    In order for the wizard to pick up the changes you have made I will suggest restarting the studio. Note that these templates are only used by the Generate OpenAccess Domain Service wizard (and not the old Data Services Wizard). You can find the wizard in the context menu of either an rlinq file or a web project in the solution explorer. 

    I hope this is helpful. Do let us know if that works for you. Also when you are done, you could share the customized templates as a code library or knowledge base article if you feel like it. Surely other customer will be able to benefit from this. 
     
    Kind regards,
    Serge
    the Telerik team
    Share your passion about the Telerik Open Access by voting for Telerik's powerful ORM tool here >>
  3. DevCraft banner
  4. Kyle T.
    Kyle T. avatar
    16 posts
    Member since:
    Dec 2011

    Posted 18 Apr 2012 Link to this post

    Serge

    Thank you for the response.  Sorry, I should have clarified.  We are using the Generate OpenAccess Domain Service wizard for our process.  I had been doing a little more experimenting yesterday and I realized that the files were being changed, but Visual Studio was not picking up that the files had been modified.  I have to close and reopen the file to see the changes.

    In my digging through the templates, it looks like parameter name/type logic would be more efficient to be embedded in the Telerik.OpenAccess.CodeGeneration.dll at some point in the future.  For example we have a Training Schedule database with a table named Class so the parameter variable name generated is class.  My plan is to create a method in the common template that you can pass a sting in and look for these instances and convert them to something else (cls for the previous example). Same for System types, we have a table named TimeZone causing an issue of ambiguity. 

    I'd be glad to make these changes available (except for the internal security process) once I have them available.  Can you point me in the direction of how to do that?  

    Thanks,
    Kyle
Back to Top