Code snippets being genned twice

Posts   
 
    
cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 26-Nov-2004 07:40:43   

I'm trying to get familiar with Template Studio v0.9.11242004 Beta M1. But, it just started generating code within <~~> tokens twice in the temporary cs file.

Here's a small example. I'm trying to emit for allEntities. Could that be the problem?


<$ D:\Program Files\Solutions Design\LLBLGen Pro\RuntimeLibraries\DotNet11\SD.LLBLGen.Pro.ORMSupportClasses.NET11.dll $>

<[ System.IO ]>
<[ System.Text ]>
<[ SD.LLBLGen.Pro.ORMSupportClasses ]>
<[ SD.LLBLGen.Pro.ApplicationCore ]>
<[ SD.LLBLGen.Pro.ApplicationCore.Entities ]>

<# ManagerBaseTemplate #>

using System;
using <%%=baseNameSpace%%>.HelperClasses;
using <%%=baseNameSpace%%>.FactoryClasses;
using <%%=baseNameSpace%%>.RelationClasses;
using <%%=baseNameSpace%%>.ValidatorClasses;

public class <%%GetObjectName()%%>ManagerBase
{
    public <%%GetObjectName()%%>ManagerBase()
    {}
}

<~
    public string baseNameSpace = _executingGenerator.ProjectDefinition.RootNameSpace;
~>

cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 26-Nov-2004 07:49:39   

BTW. I just realized my syntax was wrong with the <%% %%> blocks in my example. So, no need to correct that for me. flushed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39951
Joined: 17-Aug-2003
# Posted on: 26-Nov-2004 10:39:08   

I'll check it out. I didn't have a problem so far, but I'll try to reproduce it.

Expect a new build later today with debugging options and a solution for the "referenced dll not found" problem. simple_smile

(edit) I can't reproduce it here... the code is generated into the temp source just once.

Frans Bouma | Lead developer LLBLGen Pro
cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 26-Nov-2004 20:50:40   

Hmmm.

It's still being generated twice for me. Bummer confused

Here's the full code. Just in case.


<$ D:\Program Files\Solutions Design\LLBLGen Pro\RuntimeLibraries\DotNet11\SD.LLBLGen.Pro.ORMSupportClasses.NET11.dll $>

<[ System.IO ]>
<[ System.Text ]>
<[ SD.LLBLGen.Pro.ORMSupportClasses ]>
<[ SD.LLBLGen.Pro.ApplicationCore ]>
<[ SD.LLBLGen.Pro.ApplicationCore.Entities ]>

<# ManagerBaseTemplate #>

using System;
using <%=BaseNameSpace%>.HelperClasses;
using <%=BaseNameSpace%>.FactoryClasses;
using <%=BaseNameSpace%>.RelationClasses;
using <%=BaseNameSpace%>.ValidatorClasses;

public sealed class <%=ObjectName%>ManagerBase
{
    private <%=ObjectName%>ManagerBase()
    {}
}

<~
    public string BaseNameSpace
    {
        get { return _executingGenerator.ProjectDefinition.RootNameSpace; }
    }
    
    public string ObjectName
    {
        get
        {
            if(_activeObject==null)
            {
                return "no active object";
            }
            
            EntityDefinition e = _activeObject as EntityDefinition;
            if(e!=null)
            {
                return e.Name;
            }
            TypedListDefinition tl = _activeObject as TypedListDefinition;
            if(tl!=null)
            {
                return tl.Name;
            }
            TypedViewDefinition tv = _activeObject as TypedViewDefinition;
            if(tv!=null)
            {
                return tv.Name;
            }
            SPCallDefinition sc = _activeObject as SPCallDefinition;
            if(sc!=null)
            {
                return sc.Name;
            }
            
            // unknown object
            return "Unknown";
        }
    }
~>

And my generator config


    <tasks>
        <taskGroup description="Test generation group">
            <task name="DirectoryCreator" assemblyFilename="SD.LLBLGen.Pro.TaskPerformers.dll" taskPerformerClass="SD.LLBLGen.Pro.TaskPerformers.DirectoryCreator">
                <parameter name="folderToCreate" value="Managers"/>
                <parameter name="failWhenExistent" value="false"/>
                <parameter name="clearWhenExistent" value="false"/>
            </task>
            <task name="DirectoryCreator" assemblyFilename="SD.LLBLGen.Pro.TaskPerformers.dll" taskPerformerClass="SD.LLBLGen.Pro.TaskPerformers.DirectoryCreator">
                <parameter name="folderToCreate" value="Managers\Base"/>
                <parameter name="failWhenExistent" value="false"/>
                <parameter name="clearWhenExistent" value="false"/>
            </task>
            <task name="TestsGenerator" assemblyFilename="SD.LLBLGen.Pro.LptParser.dll" taskPerformerClass="SD.LLBLGen.Pro.LptParser.DotNetTemplateEngine">
                <parameter name="destinationFolder" value="Managers\Base"/>
                <parameter name="failWhenExistent" value="false"/>
                <parameter name="filenameFormat" value="[elementName]ManagerBase.[extension]"/>
                <parameter name="templateAssemblySourceFileFormat" value="managerTemplateClassesSource.[extension]"/>
                <parameter name="templateID" value="ManagerBaseTemplate"/>
                <parameter name="emitType" value="allEntities"/>
            </task>
        </taskGroup>
    </tasks>

I hope you can help me out. Otherwise, I'll wait for an official release. simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39951
Joined: 17-Aug-2003
# Posted on: 27-Nov-2004 10:36:17   

I'll check it out. simple_smile This is the only template in the templateset?

Frans Bouma | Lead developer LLBLGen Pro
cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 27-Nov-2004 12:10:47   

For now yes. I'm just trying to get one template working before jumping in to it full force.

I'm sure glad I did smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39951
Joined: 17-Aug-2003
# Posted on: 27-Nov-2004 17:03:25   

Out of curiosity: which template is bound to this id: <# ManagerBaseTemplate #>

Aren't you including yourself there?

Frans Bouma | Lead developer LLBLGen Pro
cmartinbot
User
Posts: 147
Joined: 08-Jan-2004
# Posted on: 28-Nov-2004 15:51:43   

This is my template.config


<templateSetDefinition>
    <vendor></vendor>
    <name></name>
    <version></version>
    <trueKeyword>true</trueKeyword>
    <falseKeyword>false</falseKeyword>
    <thisKeyword>this</thisKeyword>
    <nullKeyword>null</nullKeyword>
    <targetLanguageDescription>C#</targetLanguageDescription>
    <fileExtension>cs</fileExtension>
    <arrayIndexOperatorOpenChar>[</arrayIndexOperatorOpenChar>
    <arrayIndexOperatorCloseChar>]</arrayIndexOperatorCloseChar>
    <hasArrayIndexOperatorOnIdentifier>false</hasArrayIndexOperatorOnIdentifier>
    <lineConcatenator></lineConcatenator>
    <templateBindings>
        <!-- example binding -->
        <!-- <templateBinding templateID="SD_EntityBaseTemplate" templateFilename="..\..\..\SharedTemplates\C#\entityBase.template" /> -->
        <templateBinding templateID="ManagerBaseTemplate" templateFilename="C#\managerBase.lpt" />      
    </templateBindings>
</templateSetDefinition>

which is the template up there in the first code example.

[edit] I just realized that was the problem!!! flushed Thanks Frans