UI Builder, Property Objects
# help-with-umbraco
k
Umbraco version 13.1.0 I have a entity object like Partner - Id - Status - Company - Note Company - Id - Name - Phone Using the IConfiguratior, to add a section, if I make a list view and add Status, it works fine, but if I try to select Company.Name, it will not work.
Copy code
public void Configure(UIBuilderConfigBuilder builder)
{
    builder.AddSection("PAM", sectionConfig => sectionConfig
        .Tree(treeConfig => treeConfig
            .AddCollection<Partner>(
                x => x.Id,
                "Partner",
                "Partners",
                "List of partners",
                "icon-client",
                "icon-client",
                collectionConfig => collectionConfig
                    .SetRepositoryType<PartnerUiBuilderRepository>()

                    .SetNameProperty(x => x.Company.Name) // < Not working 

                    .ListView(listViewConfig => listViewConfig
                        .AddField(x => x.Id)
                        .AddField(x => x.Status)
                        .AddField(x => x.Note)
                        .AddField(x => x.Company.Phone)  // < Not working 
                        .SetPageSize(25))
                )));
}
Any ideas are welcome Thanks!
d
I would have been surprised if it would have worked TBH. Have you tried creating a member on Partner like
public string CompanyName => this.Company?.Name
?
k
This worked in a previous version, but doesn't seem to on newer versions
a
Check your EF config. They changed something in a previous version so it changes the way sub-entities are lazy-loaded. UI Builder doesn't like lazy-loading. You can force it to not lazy load on a query by query basis by using the .Include(x => x.Company) option, or you can set it as a global option when you configure the DbContext