-
Notifications
You must be signed in to change notification settings - Fork 813
Umbraco UI Builder release notes and details on entity identifier type converters #7006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9c5c117
b895265
eeed30d
49ffb72
1b19995
51f7861
7297824
833a4ae
e5b6a0d
5438210
35712d8
c15597d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| description: Using Umbraco entities as reference with an UI Builder collection | ||
| --- | ||
|
|
||
| # Entity Identifier Converters | ||
|
|
||
| Umbraco stores identifiers in UDI format for most Umbraco object types. | ||
|
|
||
| You can read more about them in the [UDI Identifiers](../../umbraco-cms/reference/querying/udi-identifiers.md) section of the documentation. | ||
|
|
||
| If you want to use in your model a reference to an Umbraco object and retrieve the `Integer` or `Guid` value of it, you would need to apply a conversion process to the `UDI` value. | ||
|
Check warning on line 11 in 13/umbraco-ui-builder/collections/entity-identifier-converters.md
|
||
|
|
||
| To achieve that you will need to use one of UI Builder's converters - `EntityIdentifierToIntTypeConverter` or `EntityIdentifierToGuidTypeConverter` - and add it as a `[TypeConverterAttribute]` to your model's foreign key property. | ||
|
Check warning on line 13 in 13/umbraco-ui-builder/collections/entity-identifier-converters.md
|
||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| An entity that references an Umbraco object would look like this: | ||
|
|
||
| ```csharp | ||
| [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 define and use your own custom type converter and UI Builder will take care of the data persistence. | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| description: Using Umbraco entities as reference with an UI Builder collection | ||
| --- | ||
|
|
||
| # Entity Identifier Converters | ||
|
|
||
| Umbraco stores identifiers in UDI format for most Umbraco object types. | ||
|
|
||
| You can read more about them in the [UDI Identifiers](../../umbraco-cms/reference/querying/udi-identifiers.md) section of the documentation. | ||
|
|
||
| If you want to use in your model a reference to an Umbraco object and retrieve the `Integer` or `Guid` value of it, you would need to apply a conversion process to the `UDI` value. | ||
|
Check warning on line 11 in 15/umbraco-ui-builder/collections/entity-identifier-converters.md
|
||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| To achieve that you will need to use one of UI Builder's converters - `EntityIdentifierToIntTypeConverter` or `EntityIdentifierToGuidTypeConverter` - and add it as a `[TypeConverterAttribute]` to your model's foreign key property. | ||
|
Check warning on line 13 in 15/umbraco-ui-builder/collections/entity-identifier-converters.md
|
||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| An entity that references an Umbraco object would look like this: | ||
|
|
||
| ```csharp | ||
| [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 define and use your own custom type converter and UI Builder will take care of the data persistence. | ||
eshanrnh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.