Custom Property for Entity Field

Posts   
 
    
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 09-Sep-2016 00:36:06   

Hi, I cannot find in the designer where I can add a Custom Property for an Entity Field. I am using Version 5.0.

Can someone show me how to add one?

Thanks, Dave

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 09-Sep-2016 10:37:38   

You mean a custom property for an Entity, right? If yes, then in the Code Generation sub tab you can find the option to add custom properties, attributes and interfaces.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 09-Sep-2016 15:25:06   

also for entity fields wink -> select the entity field and add the custom property. The plugin doesn't allow bulk setting on fields. Custom properties are actually surpassed by attributes which are easier to apply using rules in the project settings simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 09-Sep-2016 16:04:01   

I see in the Catalog Detail Viewer a section for the selected field that says Custom Properties but there is no way to add those properties.

I still can't find where I can add the Custom Property at the field level. Could you provide a screen shot of this?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 10-Sep-2016 09:25:56   

Fishy wrote:

I see in the Catalog Detail Viewer a section for the selected field that says Custom Properties but there is no way to add those properties.

Those are read from the database schema. If they're not in the schema, you can't add them to the schema.

I still can't find where I can add the Custom Property at the field level. Could you provide a screen shot of this? Thanks

Custom properties for entities/entityfields are edited in the entity editor. Open the entity in the editor, go to code gen info tab, select the field in the 'Element' drop down and select the custom properties tab below it to add a custom property.

More importantly though: what is it that you want to accomplish?

Frans Bouma | Lead developer LLBLGen Pro
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 10-Sep-2016 19:21:41   

I use it in a lpt file:

#Region " Fetch by fields marked as 'Index' "
<%foreach(FieldElement field in currentEntity.Fields) { %><%if (field.OutputSettingValues.CustomProperties.ContainsKey("Index")) {%>
        Public Shared Function FetchEntityCollectionBy<%=field.Name%>Plus(ByVal <%=getFieldParameter(field)%>, Optional ByVal includeFields As List(Of EntityField2) = Nothing, Optional maxEntries As Integer = 0, Optional ByVal sort As SortExpression = Nothing, Optional ByVal prefetch As List(Of PrefetchList) = Nothing) As EntityCollection(Of <%=currentEntityName%>Entity)
            Using adapter As New CustomDataAccessAdapter

                Dim EntityCollection As New EntityCollection(Of <%=currentEntityName%>Entity)
                
                adapter.FetchEntityCollection(EntityCollection, New RelationPredicateBucket(<%=currentEntityName%>Fields.<%=field.Name%> = <%=camelCase(field.Name)%>), maxEntries, sort, CreatePrefetchPaths(prefetch), If(includeFields IsNot Nothing, New IncludeFieldsList(includeFields), Nothing))

                Return EntityCollection
            End Using
        End Function<%}%><%}%>
#End Region

Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 10-Sep-2016 19:23:38   

Otis wrote:

Fishy wrote:

I see in the Catalog Detail Viewer a section for the selected field that says Custom Properties but there is no way to add those properties.

Those are read from the database schema. If they're not in the schema, you can't add them to the schema.

I still can't find where I can add the Custom Property at the field level. Could you provide a screen shot of this? Thanks

Custom properties for entities/entityfields are edited in the entity editor. Open the entity in the editor, go to code gen info tab, select the field in the 'Element' drop down and select the custom properties tab below it to add a custom property.

More importantly though: what is it that you want to accomplish?

That worked. Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-Sep-2016 10:08:21   

For purposes of driving template code, it's better to use a custom frameworksettings file with your own settings. THey're easy to set in the designer and have the advantage that you don't carry the setting around in the generated code as custom properties are generated into the code as well. http://www.llblgen.com/Documentation/5.0/SDK/Frameworksandsettings.htm

Frans Bouma | Lead developer LLBLGen Pro