NavigatorCollection attribute missing from generated code

Posts   
 
    
Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 29-Mar-2018 23:31:28   

I have added DataContract and DataMember attributes as per the following support doc.

https://www.llblgen.com/Documentation/4.2/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/Distributed%20systems/gencode_webservices.htm

When I generate my code, DataMember is not added for NavigatorCollection. DataMember is added for NormalField and NavigatorSingleValue.

When I look at entityIncludeAdapter.template in SharedTemplates, the [Foreach Attribute MappedFieldNameRelation]><[Attribute]><[NextForeach]> line is missing from the section in which the NavigatorCollection property is created.

I am using the LLBLGen framework version 4.2, VB.NET. I checked 5.3 and it is missing from that template as well.

This line does exist in the C# template, but not the VB.NET template.

I have fixed it in my template so that I can proceed.

Please advise and thank you.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Mar-2018 10:34:34   

Hi Conrad,

It actually should work the way you spec. If just tested and it is ok. I you look at the entityIncludeAdapter.template there are these lines (:558-:562) where the attributes are generated for 1:m navigators:

<[NextForeach]><[Foreach RelatedEntity OneToMany]><[If Not MappedFieldRelationIsHidden]>
        /// <summary> Gets the EntityCollection with the related entities of type '<[RelatedEntityName]>Entity' which are related to this entity via a relation of type '1:n'. If the EntityCollection hasn't been fetched yet, the collection returned will be empty.<br/><br/><[Foreach CustomProperty MappedFieldNameRelation]>
        /// <[CustomPropertyName]>: <[CustomPropertyValue]><br/><[NextForeach]></summary>
        [TypeContainedAttribute(typeof(<[RelatedEntityName]>Entity))]<[Foreach Attribute MappedFieldNameRelation]>
        <[Attribute]><[NextForeach]>

So, it should work indeed. Please check that:

  • You actually added the attribute for all navigators (not only specific ones) at Project Level (ref...)
  • When adding the attribute you pressed Tab until the attribute was added to grid and not just remained in the 'new item' row of the grid
  • You generated code to the right location where your entities live
David Elizondo | LLBLGen Support Team
Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 30-Mar-2018 17:07:02   

Is see the attribute code in the ManyToMany section (that's the section you specified, I think). What about the OneToMany section above it? I think that's the section that my code is using.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-Mar-2018 04:00:58   

Conrad wrote:

Is see the attribute code in the ManyToMany section (that's the section you specified, I think). What about the OneToMany section above it? I think that's the section that my code is using.

OneToMany was the section that I referred above. Anyway it’s present in all relationship types. So please double check the points I posted.

David Elizondo | LLBLGen Support Team
Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 02-Apr-2018 17:28:26   

I'm sorry if I seem a bit obtuse about this, but I just don't see it. I downloaded version 5.3 last Thursday. If I take a look at my LLBLGen Pro v5.3\Frameworks\LLBLGen Pro\Templates\SharedTemplates\Net3.5\VB.NET folder\entityIncludeAdapter.template file, I see the following code starting with line 524.:

<[Foreach RelatedEntity OneToMany CrLf]><[If Not MappedFieldRelationIsHidden]> ''' <summary>Gets the EntityCollection with the related entities of type '<[RelatedEntityName]>Entity' which are related to this entity via a relation of type '1:n'. If the EntityCollection hasn't been fetched yet, the collection returned will be empty.<br/><br/> ''' <[Foreach CustomProperty MappedFieldNameRelation]> ''' <[CustomPropertyName]>: <[CustomPropertyValue]><br/><[NextForeach]></summary> <TypeContainedAttribute(GetType(<[RelatedEntityName]>Entity))> _ <[ If SettingValueEquals MappedFieldNameRelation "NavigatorPropertyIsPublic" "true"]>Public<[Else]>Friend<[EndIf]> Overridable ReadOnly Property <[MappedFieldNameRelation]> As EntityCollection(Of <[RelatedEntityName]>Entity) Get If _<[CaseCamel MappedFieldNameRelation]> Is Nothing Then _<[CaseCamel MappedFieldNameRelation]> = New EntityCollection(Of <[RelatedEntityName]>Entity)(EntityFactoryCache2.GetEntityFactory(GetType(<[RelatedEntityName]>EntityFactory))) _<[CaseCamel MappedFieldNameRelation]>.ActiveContext = Me.ActiveContext <[ If OppositeRelationPresent ]> _<[CaseCamel MappedFieldNameRelation]>.SetContainingEntityInfo(Me, "<[RelatedMappedFieldNameRelation]>")<[ EndIf ]> End If Return _<[CaseCamel MappedFieldNameRelation]> End Get End Property<[EndIf]><[NextForeach]> <[Foreach RelatedEntity ManyToMany CrLf]><[If Not MappedFieldRelationIsHidden]> ''' <summary>Gets the EntityCollection with the related entities of type '<[RelatedEntityName]>Entity' which are related to this entity via a relation of type 'm:n'. If the EntityCollection hasn't been fetched yet, the collection returned will be empty.<br/><br/> ''' <[Foreach CustomProperty MappedFieldNameRelation]> ''' <[CustomPropertyName]>: <[CustomPropertyValue]><br/><[NextForeach]></summary> <TypeContainedAttribute(GetType(<[RelatedEntityName]>Entity))> _<[Foreach Attribute MappedFieldNameRelation]> <[Attribute]><[NextForeach]> <[ If SettingValueEquals MappedFieldNameRelation "NavigatorPropertyIsPublic" "true"]>Public<[Else]>Friend<[EndIf]> Overridable ReadOnly Property <[MappedFieldNameRelation]> As EntityCollection(Of <[RelatedEntityName]>Entity) Get If _<[CaseCamel MappedFieldNameRelation]> Is Nothing Then _<[CaseCamel MappedFieldNameRelation]> = New EntityCollection(Of <[RelatedEntityName]>Entity)(EntityFactoryCache2.GetEntityFactory(GetType(<[RelatedEntityName]>EntityFactory))) _<[CaseCamel MappedFieldNameRelation]>.ActiveContext = Me.ActiveContext <[CaseCamel MappedFieldNameRelation]>.IsReadOnly = True CType(<[CaseCamel MappedFieldNameRelation]>, IEntityCollectionCore).IsForMN = True End If Return _<[CaseCamel MappedFieldNameRelation]> End Get End Property<[EndIf]><[NextForeach]> <[Foreach RelatedEntity ManyToOne CrLf]><[If Not MappedFieldRelationIsHidden]> ''' <summary>Gets / sets related entity of type '<[RelatedEntityName]>Entity' which has to be set Imports a fetch action earlier. If no related entity is set for this property, null is returned. ''' This property is not visible in databound grids.<br/><br/> ''' <[Foreach CustomProperty MappedFieldNameRelation]> ''' <[CustomPropertyName]>: <[CustomPropertyValue]><br/><[NextForeach]></summary><[Foreach Attribute MappedFieldNameRelation]> <[Attribute]><[NextForeach]> <[ If SettingValueEquals MappedFieldNameRelation "NavigatorPropertyIsPublic" "true"]>Public<[Else]>Friend<[EndIf]> Overridable Property <[MappedFieldNameRelation]> As <[RelatedEntityName]>Entity Get Return _<[CaseCamel MappedFieldNameRelation]> End Get Set If MyBase.IsDeserializing Then SetupSync<[MappedFieldNameRelation]>(value) Else SetSingleRelatedEntityNavigator(value, "<[RelatedMappedFieldNameRelation]>", "<[MappedFieldNameRelation]>", _<[CaseCamel MappedFieldNameRelation]>, <[If OppositeRelationPresent]>True<[Else]>False<[EndIf]>) End If End Set End Property<[EndIf]><[NextForeach]>

This has the one to many, many to many and many to one navigators. I see the ForEach Attribute in the many to many and many to one navigators, but not there for the one to many navigator. Again, I apologize for pressing on this, but I just don't see it.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 02-Apr-2018 23:07:00   

I can see that they are missing from the VB templates.

Thanks for reporting.

Conrad
User
Posts: 37
Joined: 11-Jan-2008
# Posted on: 02-Apr-2018 23:11:27   

I thought I was going crazy there. No problem.

And thank you all for the quick replies.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 03-Apr-2018 08:53:19   

We'll look into it!

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 03-Apr-2018 09:35:10   

Rest was ok, selfservicing did have the attribute, so it was just in adapter. Now fixed: 5.2.8 hotfix build and 5.3.5 hotfix builds have this fix. Thanks for reporting!

Frans Bouma | Lead developer LLBLGen Pro