FieldInfoProviderSingleton class missing

Posts   
 
    
DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 15-Mar-2019 21:26:35   

Hi,

The EntityFieldFactory class was missing after migrating from v5.2 to v5.5, but after looking at the breaking changes section I found out this is by design.

Two questions : what's the alternative ? And how can I fix the error of the missing FieldInfoProviderSingleton class after I modified the project settings for generating the factory-classes for backwards compatibility.

Greetz, Danny

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-Mar-2019 04:11:32   

Hi Danny,

Actually, it's documented in the Migrating your code section:

Documentation wrote:

Adapter: the EntityFieldFactory type has been removed as it's no longer used. The class FactoryClasses\EntityFieldFactory.cs/vb is by default removed from disk by the code generator. If you relied on this class in your own code for the two methods it provided, please enable the setting Project settings -> Conventions -> Entity Model -> LLBLGen Pro Runtime Framework -> Generate entity field factory. When this setting is enabled, the existing class is kept on disk and re-generated with each code generation cycle. It's not needed / used by the runtime framework anymore.

Also, in Available output settings values:

Documentation wrote:

Generated code, Adapter, backwards compatibility GenerateEntityFieldFactory When set to true (default is false), the code generator will for Adapter generate an **EntityFieldFactory **class. Set this setting to true if you need the functionality of EntityFieldFactory. It's not generated by default. If set to false, an existing EntityFieldFactory class will be removed from the output folder.

David Elizondo | LLBLGen Support Team
DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 18-Mar-2019 09:33:10   

Hi David,

That's exactly what I did ! Both the EntityFieldFactory and EntityFieldsFactory classes are being generated, but there's a call to the FieldInfoProviderSingleton class which is not generated. So here's my question, how can I (re)generate this class ?

greetz, Danny

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 18-Mar-2019 15:46:33   

Hmm. So you just have these settings enabled and the code generated with these settings enabled results in incompilable code? If so, that's a bug and we need to correct that. (the class is now available through the ModelInfoprovider).

Frans Bouma | Lead developer LLBLGen Pro
DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 18-Mar-2019 15:49:26   

Correct. That's what is happening, at least within dev-environment with the latest version 5.5 (5.5.2) RTM from March 7.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 18-Mar-2019 16:23:25   

Thanks for confirming. We'll look into it and get back to you asap

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 18-Mar-2019 16:32:46   

Can't reproduce it. Are you sure the files are overwritten?

I generate into a new folder, I get both EntityFieldFactory and EntityFieldsFactory generated. They look like the code below:


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

namespace NWLegacy.FactoryClasses
{
    /// <summary>Generates IEntityFields2 instances for different kind of Entities. For backwards compatibility.</summary>
    public static partial class EntityFieldsFactory
    {
        /// <summary>General factory entrance method which will return an EntityFields2 object with the format generated by the factory specified</summary>
        /// <param name="relatedEntityType">The type of entity the fields are for</param>
        /// <returns>The IEntityFields instance requested</returns>
        public static IEntityFields2 CreateEntityFieldsObject(NWLegacy.EntityType relatedEntityType)
        {
            return ModelInfoProviderSingleton.GetInstance().GetEntityFields(relatedEntityType.ToString());
        }


    }
}



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

namespace NWLegacy.FactoryClasses
{
    /// <summary>Factory class for IEntityField2 instances, used in IEntityFields2 instances. For backwards compatibility</summary>
    public static partial class EntityFieldFactory
    {
        /// <summary>Creates a new IEntityField2 instance for usage in the EntityFields object for the entity related to the field index specified.</summary>
        /// <param name="fieldIndex">The field which IEntityField2 instance should be created</param>
        /// <returns>The IEntityField2 instance for the field specified in fieldIndex</returns>
        public static IEntityField2 Create(Enum fieldIndex) { return new EntityField2(ModelInfoProviderSingleton.GetInstance().GetFieldInfo(fieldIndex)); }

        /// <summary>Creates a new IEntityField2 instance, which represents the field objectName.fieldName</summary>
        /// <param name="objectName">the name of the object the field belongs to, like CustomerEntity or OrdersTypedView</param>
        /// <param name="fieldName">the name of the field to create</param>
        public static IEntityField2 Create(string objectName, string fieldName) { return new EntityField2(ModelInfoProviderSingleton.GetInstance().GetFieldInfo(objectName, fieldName)); }

    }
}

Please make sure the files are overwritten properly. We also have a test in place which generates a project with these settings enabled and compiles fine. So there's something off somewhere.

Frans Bouma | Lead developer LLBLGen Pro
DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 18-Mar-2019 16:42:50   

I see that your code references the ModelInfoProviderSingleton. My generated code references the FieldInfoProviderSingleton. That's weird !

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 19-Mar-2019 09:02:17   

yeah I think the file you have isn't overwritten, perhaps it's readonly? Could you check the log that's created after you generate code and see whether the file is indeed generated?

Frans Bouma | Lead developer LLBLGen Pro
DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 19-Mar-2019 09:18:24   

I do see this :


Task execution log of tasks for group ''.
Task execution started on: 19-Mar-2019 09:13.46
Task group: SD.Presets.Adapter.General. For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE).
Task group: SD.Tasks.Adapter.DatabaseGeneric. For database: SQL Server (SqlClient) (2D18D138-1DD2-467E-86CC-4838250611AE).
Task: Remove FieldInfoProvider class (SD.Tasks.Base.FileRemover)
File to remove 'D:\Projects\TFS\Avalanche-Main\Avalanche\TodayIT.Avalanche.Data\SqlServer.v55\DatabaseGeneric\HelperClasses\FieldInfoProvider.vb' was already removed. Task ignored.
Task: Remove InheritanceInfoProvider class (SD.Tasks.Base.FileRemover)
File to remove 'D:\Projects\TFS\Avalanche-Main\Avalanche\TodayIT.Avalanche.Data\SqlServer.v55\DatabaseGeneric\HelperClasses\InheritanceInfoProvider.vb' was already removed. Task ignored.
TaskGroupElement 'Remove EntityFieldsFactory class if it's no longer wanted (SD.Tasks.Base.FileRemover)' was skipped because its Perform Rule resolved to false.
TaskGroupElement 'Remove EntityFieldFactory class if it's no longer wanted (SD.Tasks.Base.FileRemover)' was skipped because its Perform Rule resolved to false.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 19-Mar-2019 15:31:33   

VB, I checked C#... but I assume it'll be the same but we'll check.

You also should see a log entry for every class generated.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 19-Mar-2019 15:36:17   

Reproduced on VB.NET.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 19-Mar-2019 15:47:47   

Fixed in next hotfix build. As there is another pending issue by you we'll wait till that's resolved before pushing a new build.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 21-Mar-2019 11:07:59   

Hotfix is now available.

Frans Bouma | Lead developer LLBLGen Pro
DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 21-Mar-2019 22:49:21   

Thank you !