TvfCallFactory generated invalid method parameters

Posts   
 
    
MoGoMo
User
Posts: 6
Joined: 25-Jul-2022
# Posted on: 08-Aug-2022 00:24:18   

The following file was auto-generated by LLBLGen and seems to be created with an invalid method parameter:

//////////////////////////////////////////////////////////////
// <auto-generated>This code was generated by LLBLGen Pro v5.9.</auto-generated>
//////////////////////////////////////////////////////////////
// Code is generated on: 
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System;
using System.Linq;
using SD.LLBLGen.Pro.ORMSupportClasses;
using CDS.DataAccessLayer.HelperClasses;

namespace CDS.DataAccessLayer.FactoryClasses
{
    /// <summary>Static factory class for creating TableValuedFunctionCall objects.</summary>
    public static partial class TvfCallFactory
    {
        /// <summary>Creates a TableValuedFunctionCall object for the TvfCallDefinition 'Dbo.UtilfnSplit'. Returns a set of elements of type 'Dbo.UtilfnSplitResult'.</summary>
        /// <param name="alias">The alias to specify for the query fetching the TVF.</param>
        /// <param name="string">parameter of the TVF</param>
        /// <param name="delimiter">parameter of the TVF</param>
        /// <returns>ready to use TableValuedFunctionCall</returns>
        public static TableValuedFunctionCall UtilfnSplit(string alias, System.String string, System.String delimiter)
        {
            return new TableValuedFunctionCall(ModelInfoProviderSingleton.GetInstance().GetTypedViewFields("UtilfnSplitResultTypedView"), alias, "UtilfnSplit", string, delimiter);
        }
        
    }
}

When trying to compile this, the method argument of "System.String string" is invalid as "string" is a reserved word in C#. I can fix this locally by renaming it to "str", but it is recreated each time I run the tool

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 08-Aug-2022 08:41:19   

Hmm, that's indeed a side effect of the designer not checking for reserved words in the target language. The 'string' parameter is a parameter of the TvF call I presume? You can rename it in the designer, by opening the editor for the UtilfnSplit TvF call by right-clicking it in the project explorer -> Edit. Then you can select the 'string' parameter and rename it to something else. Regenerating the code will then always use that name.

Frans Bouma | Lead developer LLBLGen Pro
MoGoMo
User
Posts: 6
Joined: 25-Jul-2022
# Posted on: 08-Aug-2022 23:32:42   

Oh sweet, I didn't even realize it was one of our functions! That solved it, thanks