Umbraco UI Builder
CMSCloudHeartcoreDXP
16.latest
16.latest
  • Umbraco UI Builder Documentation
  • Known Issues
  • Release Notes
  • Getting Started
    • Requirements
    • Installing Umbraco UI Builder
    • Licensing
    • Configuration
    • User Interface
  • Upgrading
    • Upgrading Umbraco UI Builder
    • Version Specific Upgrade Notes
    • Migrate from Konstrukt to Umbraco UI Builder
  • How-to Guides
    • Creating your First Integration
  • Areas
    • Overview
    • Sections
      • Summary Dashboards
    • Trees
      • Folders
    • Dashboards
    • Context Apps
  • Collections
    • Overview
    • The Basics
    • List Views
      • Field Views
    • Editors
    • Child Collections
      • Child Collection Groups
      • Retrieve Child Collections
    • Related Collections
    • Entity Identifier Converters
  • Searching
    • Overview
    • Searchable Properties
  • Filtering
    • Overview
    • Global Filters
    • Data Views
      • Data Views Builders
    • Filterable Properties
  • Actions
    • Overview
    • The Basics
    • Action Visibility
    • Inbuilt Actions
  • Cards
    • Overview
    • Count Cards
    • Custom Cards
  • Property Editors
    • Overview
    • Entity Picker
  • Advanced
    • Virtual Sub Trees
    • Encrypted Properties
    • Value Mappers
    • Repositories
    • Events
  • Miscellaneous
    • Conventions
    • Umbraco Aliases
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Collections

Entity Identifier Converters

Using Umbraco entities as reference with an UI Builder collection

Umbraco stores identifiers in UDI format for most Umbraco object types.

You can read more about them in the UDI Identifiers section of the documentation.

If you want to reference an Umbraco object in your model and retrieve its Integer or Guid value, you must convert the UDI value.

Use one of UI Builder's converters - EntityIdentifierToIntTypeConverter or EntityIdentifierToGuidTypeConverter. Add it as a [TypeConverterAttribute] to your model's foreign key property.

An entity that references an Umbraco object would look like this:

    [TableName(TableName)]
    [PrimaryKey("Id")]
    public class MemberReview
    {
        public const string TableName = "MemberReview";

        [PrimaryKeyColumn]
        public int Id { get; set; }

        public string Title { get; set; }

        public string Content { get; set; }

        [TypeConverter(typeof(EntityIdentifierToIntTypeConverter))]
        public int MemberId { get; set; }
    }

You can also create a custom type converter. UI Builder will handle data persistence automatically.

PreviousRelated CollectionsNextOverview

Last updated 2 months ago

Was this helpful?