Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Custom Templates> Custom DotNetTemplateEngine with custom settings and templates in 4.2
 

Pages: 1
Custom Templates
Custom DotNetTemplateEngine with custom settings and templates in 4.2
Page:1/1 

  Print all messages in this thread  
Poster Message
vzakanj
User



Location:

Joined on:
17-May-2013 16:30:21
Posted:
4 posts
# Posted on: 23-Jan-2016 00:03:57.  
I've added some custom settings to frameworksettings file and want to use them as placeholders in task parameters, e.g. a setting named Foo would be usable as a task performer parameter by specifying it as [Foo] (the same way default placeholders work).

To do this, I've inherited the DotNetTemplateEngine (the project is using .NET Framework 4.5.2) and overriden the Perform method in the following manner:

Code:
public override void Perform(
IGenerator executingGenerator,
ITask taskDefinition, Dictionary<string, TaskParameter> parameters)
{
    var configReader = ProjectConfigurationReader.Create(executingGenerator.ProjectDefinition);
    var resolvedParameters = this.paramResolver.ResolveParams(configReader, parameters);

    base.Perform(executingGenerator, taskDefinition, resolvedParameters);
}


The ProjectConfigurationReader and ParamResolver are just helper classes which go through the placeholder parameter values and replace them with the values from project definition custom settings.
I've done everything needed to use this custom task performer in the designer (specified custom task performers folder with the resulting dll in it, created custom task definition, created custom templates and templatebindings etc.), but when generating the code the designer shows that there's been an error while compiling the templates: "The type or namespace name 'ITemplateClass' could not be found (are you missing a using directive or an assembly reference?)".
This error doesn't happen if there's at least one task which uses the original DotNetTemplateEngine task performer before my custom task in the designer task queue.

ITemplateClass is located in SD.LLBLGen.Pro.LptParser, so what this error is indicating that the compiler doesn't have an assembly reference to SD.LLBLGen.Pro.LptParser.dll when compiling the template, but the docs state what I've pasted below so I guess the reference should already be there.

From 4.2 docs:
Quote:

The following assemblies are already referenced by the code produced by the DotNetTemplateEngine:
SD.LLBLGen.Pro.GeneratorCore.dll
SD.LLBLGen.Pro.ApplicationCore.dll
SD.LLBLGen.Pro.DBDriverCore.dll
SD.LLBLGen.Pro.LptParser.dll
SD.LLBLGen.Pro.Core.dll
SD.Tools.Algorithmia.dll
SD.Tools.BCLExtensions.dll
mscorlib
System.dll
System.Core.dll
System.Data.dll


I've tried copying the SD.LLBLGen.Pro.LptParser assembly to the custom task performers folder as well as all folders which are specified as probing path in the designer configuration file (e.g. ReferencedAssemblies), and adding an assembly reference declaration in the template as specified below, but with no luck.

Code:
<$ SD.LLBLGen.Pro.LptParser.dll $>


The only thing that worked is specifying the full path to the assembly:
Code:
<$ C:\Program Files (x86)\Solutions Design\LLBLGen Pro v4.2\TaskPerformers\SD.LLBLGen.Pro.LptParser.dll $>


I'm wondering if there's a way not to have to add that declaration to the custom templates or at least just use the assembly name without the full path?


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8076 posts
# Posted on: 26-Jan-2016 06:03:15.  
IMHO you don't need to add such reference, as it's already referenced by the code produced by the DotNetTemplateEngine.

Could you share your TaskPerformer code and a list of steps to reproduce the problem? (You can do it in a HelpDesk thread (which is private).


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
vzakanj
User



Location:

Joined on:
17-May-2013 16:30:21
Posted:
4 posts
# Posted on: 31-Jan-2016 06:40:35.  
I'll post the code and an example in a new HelpDesk thread then.
  Top
ch
User



Location:

Joined on:
25-Apr-2015 19:42:06
Posted:
27 posts
# Posted on: 16-Sep-2017 10:16:29.  
I fixed it just as the previous person in the first mentioned thread.
I added to the lpt template the exact location of the parser.

using System;
using System.Collections;
using System.Data;
using SD.LLBLGen.Pro.ORMSupportClasses;
<$ D:\Program Files (x86)\Solutions Design\LLBLGen Pro v5.0\TaskPerformers\SD.LLBLGen.Pro.LptParser.dll $>


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.