Migrating manager templates from 2.6 to 3.0

Posts   
 
    
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 10-Jan-2011 21:49:55   

Hi I am trying to migrate some manager templates from v2.6 to version 3... Just purchased the upgrade today - been using v2.6 for some time - fancied a change!!

I have wired everything up correctly and when I generate the project I get some (not many) compilation errors.. hardly surprising given the new release. I need now to work out how to fix the problems as I really need to get the manager templates working since they save me soooo much time simple_smile

I think the issue lies in my .lpt templates which have some functions that are written in C# and are used to control what is written. 2 such functions are

public bool FieldsContains(EntityFieldsCollection fields, string fieldName)
        {
            return FieldsContains(fields, fieldName, false);
        }

        public bool FieldsContains(EntityFieldsCollection fields, string fieldName, bool endsWith)
        {
            foreach (EntityFieldDefinition field in Entity.Fields)
            {
                if (endsWith)
                {
                    if (field.FieldName.EndsWith(fieldName))
                        return true;
                } else if (field.FieldName == fieldName)
                    return true;
            }
            return false;
        }

The compiler does not like "EntityFieldsCollection" in the parameters for both functions

In fact when I look at the errors list it does not like

EntityFieldsCollection EntityRelation EntityFieldDefinition EntityRelationCollection

That's it. Can you point me to the right documentation to work out the V3.0 equivalents of these 4 items and hopefully I should be able to work it out.

Many thanks in advance

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-Jan-2011 08:14:03   

EntityFieldsCollection now is FieldList<FieldElement> EntityFieldDefinition now is FieldElement so on...

I recommend you to download LLBLGenPro.CoreAssemblies.ReferenceManual help file (from customer area) and check the new included templates on v3, that will give you an idea of the changes on the template system.

David Elizondo | LLBLGen Support Team
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 11-Jan-2011 20:02:14   

Many thanks for that, I have replaced

EntityFieldsCollection with FieldList<FieldElement> EntityFieldDefinition with FieldElement EntityRelationship with FieldRelationship EntityRelationshipCollection with FieldRelationshipCollection

and that has removed all but one of my compile errors

The only error that remains is

"The type or namespace name "Entities" does not exist in namespace 'SD.LLBLGen.Pro.ApplicationCore' (are you missing an assembly or reference?)

In the file lptTemplateDebugSourceInclude.cs file the error is highlighted as


using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Data;
using SD.LLBLGen.Pro.GeneratorCore;
using SD.LLBLGen.Pro.ApplicationCore;
using SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData;
using SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Tasks;
using SD.LLBLGen.Pro.ApplicationCore.CodeGenerationMetaData.Templates;
using SD.LLBLGen.Pro.ApplicationCore.EntityModel;
using SD.LLBLGen.Pro.ApplicationCore.EntityModel.TypedLists;
using SD.LLBLGen.Pro.ApplicationCore.TypedViews;
using SD.LLBLGen.Pro.ApplicationCore.StoredProcedureCalls;
using SD.LLBLGen.Pro.ApplicationCore.ProjectClasses;
using SD.LLBLGen.Pro.ApplicationCore.Mapping;
using SD.LLBLGen.Pro.ApplicationCore.MetaData;
using SD.LLBLGen.Pro.Core;
using SD.LLBLGen.Pro.Core.GeneralDataStructures;
using SD.LLBLGen.Pro.DBDriverCore;
using SD.LLBLGen.Pro.LptParser;
using System.Diagnostics;
using SD.LLBLGen.Pro.ApplicationCore.Entities;


public class Blue_PrefectPathElementCollectionTemplate : ITemplateClass {
    private StreamWriter __outputWriter;
    private IGenerator _executingGenerator;
    private Dictionary<string, TaskParameter> _parameters;
    private object _activeObject;

    public Blue_PrefectPathElementCollectionTemplate() {

You can see that the last "using" statement lists SD.LLBLGen.Pro.ApplicationCore.Entities which needs to be removed because the EntityModel namespace is already added a few lines earlier

I dont see how this line of code was added to the file and hence why I am getting the error.. There are no "using" statements in my template code... How do I get rid of it and hence the error

I hope you understand what I mean and how can I fix this?

Many thanks

hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 11-Jan-2011 20:59:15   

Ignore last message - found the problem