Entity Framework 5 - pocoHelperClasses.lpt

Posts   
 
    
basik
User
Posts: 123
Joined: 20-Aug-2012
# Posted on: 14-Jan-2013 12:41:33   

The template is found here: LLBLGen Pro v3.5\Frameworks\Entity Framework\Templates\V4\C#\pocoHelperClasses.lpt

If it is included in the SD.EntityFramework.v5 template binding it does not produce a set of POCO helper classes as I expected it to.


//------------------------------------------------------------------------------
// <auto-generated>This code was generated by LLBLGen Pro v<%=ApplicationConstants.LLBLGenProVersion%>. Code is largely based on the POCO templates shipped by Microsoft. </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;

namespace <%=_executingGenerator.RootNamespaceToUse%>
{
    /// <summary>An System.Collections.ObjectModel.ObservableCollection that raises individual item removal notifications on clear and prevents adding duplicates.</summary>
    /// <typeparam name="T"></typeparam>
    public class FixupCollection<T> : ObservableCollection<T>
    {
        /// <summary>clears the items.</summary>
        protected override void ClearItems()
        {
            new List<T>(this).ForEach(t => Remove(t));
        }

        /// <summary>Inserts the item.</summary>
        /// <param name="index">The index.</param>
        /// <param name="item">The item.</param>
        protected override void InsertItem(int index, T item)
        {
            if (!this.Contains(item))
            {
                base.InsertItem(index, item);
            }
        }
    }
}

The pocoTypedViewClass.lpt and pocoValueTypeClass.lpt templates in the same location have code which looks like it would produce the correct classes for typed views and value types.

I've attached a screenshot of the configured preset - I created a copy of the existing SD.EntityFramework.v5 preset and added the template and folder tasks. Code generation works fine, except for the HelperClasses which just produces a single output file called: [elementName].cs.

Please could someone confirm if the template is correct or not. Thank you.

Attachments
Filename File size Added on Approval
CustomPresetWithpocoHelperClasses.png 61,342 14-Jan-2013 12:41.47 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Jan-2013 06:32:28   

Hi basik,

That template (SD_EF_POCO_HelperClasses) is intended to be generic, that means it's intended to generate just one file. The parameter 'emitType' value should be 'generic', the parameter 'elementFilter' should be blank, and the parameter 'filenameFormat' should be something generic like 'SelfTrackingHelperClasses.[extension]'.

You can see an example looking at the SD.EntityFramework.v4 (Proxy friendly POCO entities) tasks.

David Elizondo | LLBLGen Support Team
basik
User
Posts: 123
Joined: 20-Aug-2012
# Posted on: 15-Jan-2013 12:19:56   

Thank you for the reply. Like all new things it takes a while to get your head around the semantics, but I am pleased with the Template functionality and hope to enhance our code generation even further. Please go ahead and close this thread.

Btw, we've renamed LLBLGen Pro to LLCoolGen Pro as we love the product but not the name.