You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Configuring encrypted properties in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2
+
description: Configuring and using encrypted properties in Umbraco UI Builder to securely store sensitive data.
3
3
---
4
4
5
5
# Encrypted Properties
6
6
7
-
If needed to collect sensitive information in a collection but don't want to persist in a plain text format to the data storage mechanism. Umbraco UI Builder can help with this by allowing you to define properties as encrypted. After which any time the value is persisted or retrieved from persistence, Umbraco UI Builder will automatically encrypt and decrypt the value.
7
+
Umbraco UI Builder allows encrypting properties to store sensitive information securely. When a property is marked as encrypted, its value is automatically encrypted before storage and decrypted upon retrieval.
8
8
9
9
{% hint style="info" %}
10
-
Umbraco UI Builder uses the `IDataProtectionProvider` instance registered in the DI container to perform its encryption/decryption. If you need to change the encryption algorithm, you should replace the `IDataProtectionProvider` instance in the DI container.
10
+
Umbraco UI Builder uses the `IDataProtectionProvider` instance registered in the DI container for encryption and decryption. To modify the encryption algorithm, replace the `IDataProtectionProvider` instance in the DI container.
Adds the given property to the encrypted properties collection. Property must be of type `String`. When set, the property will be encrypted/decrypted on write/read respectively.
17
+
Encrypts the specified property. The property must be of type `String`. The value is encrypted before storage and decrypted when retrieved.
Copy file name to clipboardExpand all lines: 15/umbraco-ui-builder/advanced/events.md
+40-32Lines changed: 40 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
---
2
-
description: Configuring event handlers in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2
+
description: Configuring event handlers in Umbraco UI Builder.
3
3
---
4
4
5
5
# Events
6
6
7
-
Umbraco UI Builder fires a number of notification events during regular operation to allow for extending of the default behaviour.
7
+
Umbraco UI Builder triggers different notification events during operation, allowing customization of default behavior.
8
8
9
-
## Registering event handlers
9
+
## Registering Event Handlers
10
10
11
-
Umbraco UI Builder uses the same [Notification Mechanism built into Umbraco v9+](../../umbraco-cms/fundamentals/code/subscribing-to-notifications.md) and so uses the same registration process. First you will need to define a notification event handler for the event you wish to handle like below:
11
+
Umbraco UI Builder follows the [Umbraco Notification mechanism](../../umbraco-cms/fundamentals/code/subscribing-to-notifications.md) for event registration.
12
+
13
+
Define a notification event handler for the target event:
Triggers when `Save` is called before persisting the entity. The notification contains an `Entity` property with `Before` and `After` values, providing access to the previous and updated entities. Modify the `After` entity to persist changes. If the `Cancel` property of the notification is set to `true` then the save operation will be canceled and no changes will be saved.
39
43
40
-
Raised when the repository `Save` method is called and before the entity has been persisted. The notification contains an `Entity` property with `Before` and `After` inner properties. These properties provide access to a copy of the currently persisted entity (or null if a new entity) and the updated entity that´s saved.
41
-
Changes can be made to the `After` entity and they will be persisted as part of the save operation. If the `Cancel` property of the notification is set to `true` then the save operation will be canceled and no changes will be saved.
Triggers when the repository `Save` method is called and after the entity has been persisted. The notification contains an `Entity` property with `Before` and `After` inner properties. These properties provide access to a copy of the previously persisted entity (or null if a new entity) and the updated entity that´s saved.
@@ -74,12 +77,13 @@ public class MyEntitySavedEventHandler : INotificationHandler<EntitySavedNotifi
74
77
}
75
78
```
76
79
77
-
### **EntityDeletingNotification**
80
+
### Using the `EntityDeletingNotification()`
81
+
82
+
Triggers when the repository `Delete` method is called and **before** the entity is deleted. The notification contains an `Entity` property providing access to a copy of the entity about to be deleted. If the `Cancel` property of notification is set to `true` then the delete operation will be cancelled and entity won't be deleted.
78
83
79
-
Raised when the repository `Delete` method is called and **before** the entity is deleted. The notification contains an `Entity` property providing access to a copy of the entity about to be deleted. If the `Cancel` property of notification is set to `true` then the delete operation will be cancelled and entity won't be deleted.
@@ -91,14 +95,15 @@ public class MyEntityDeletingEventHandler : INotificationHandler<EntityDeleting
91
95
}
92
96
93
97
}
94
-
````
98
+
```
99
+
100
+
### Using the `EntityDeletedNotification()`
95
101
96
-
### **EntityDeletedNotification**
102
+
Triggers when the repository `Delete` method is called and **after** the entity has been deleted. The notification contains an `Entity` property providing access to a copy of the entity that´s deleted.
97
103
98
-
Raised when the repository `Delete` method is called and **after** the entity has been deleted. The notification contains an `Entity` property providing access to a copy of the entity that´s deleted.
@@ -112,12 +117,13 @@ public class MyEntityDeletedEventHandler : INotificationHandler<EntityDeletedNo
112
117
}
113
118
```
114
119
115
-
### **SqlQueryBuildingNotification**
120
+
### Using the `SqlQueryBuildingNotification()`
116
121
117
-
Raised when the repository is **preparing** a SQL query. The notification contains the collection alias + type, the NPoco `Sql<ISqlContext>` object, and the where clause/order by clauses. These will be used to generate the SQL query.
122
+
Triggers when the repository is **preparing** a SQL query. The notification contains the collection alias + type, the NPoco `Sql<ISqlContext>` object, and the where clause/order by clauses. These will be used to generate the SQL query.
@@ -128,12 +134,13 @@ public class MySqlQueryBuildingEventHandler : INotificationHandler<SqlQueryBuil
128
134
}
129
135
```
130
136
131
-
### **SqlQueryBuiltNotification**
137
+
### Using the `SqlQueryBuiltNotification()`
138
+
139
+
Triggers when the repository has **repaired** a SQL query. The notification contains the collection alias + type, the NPoco `Sql<ISqlContext>` object and the where clause/order by clauses that was used to generate the SQL query.
132
140
133
-
Raised when the repository has **repaired** a SQL query. The notification contains the collection alias + type, the NPoco `Sql<ISqlContext>` object and the where clause/order by clauses that was used to generate the SQL query.
@@ -144,12 +151,13 @@ public class MySqlQueryBuiltEventHandler : INotificationHandler<SqlQueryBuiltNo
144
151
}
145
152
```
146
153
147
-
## Repository events validation
154
+
## Repository Events Validation
155
+
156
+
From version `15.1.0`, complex server-side validation can be added to a collection using the `CancelOperation` method of the notification.
148
157
149
-
Starting with version `15.1.0`, complex server-side validation can be added to a collection by calling the `CancelOperation` method of the notification.
Copy file name to clipboardExpand all lines: 15/umbraco-ui-builder/advanced/repositories.md
+47-17Lines changed: 47 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
-
description: Configuring repositories in Umbraco UI Builder, the backoffice UI builder for Umbraco.
2
+
description: Configure repositories in Umbraco UI Builder.
3
3
---
4
4
5
5
# Repositories
6
6
7
-
Repositories are used by Umbraco UI Builder to access the entity data stores. By default, collections will use a generic built-in NPoco repository. However, you can define your own repository implementation should you wish to store your entities via an alternative strategy.
7
+
Repositories in Umbraco UI Builder manage entity data storage. By default, collections use a built-in NPoco repository. To use a different storage strategy, define a custom repository implementation.
8
8
9
-
## Defining a repository
9
+
## Defining a Repository
10
10
11
-
To define a repository create a class that inherits from the base class `Repository<TEntity, TId>` and implements all of its abstract methods.
11
+
Create a class that inherits from `Repository<TEntity, TId>` and implements all abstract methods.
12
12
13
13
````csharp
14
14
// Example
@@ -58,39 +58,62 @@ public class PersonRepository : Repository<Person, int> {
58
58
}
59
59
````
60
60
61
-
**Note:** For all `Impl` methods there are public alternatives without the `Impl` suffix. However, there are separate implementation methods in order to ensure all repositories fire the relevant Umbraco UI Builder events. This is whether triggered via the Umbraco UI Builder's UI or not.
61
+
{% hint style="info" %}
62
+
`Impl` methods have public alternatives without the suffix. Separate implementation methods ensure repositories trigger Umbraco UI Builder events, whether actions originate from the UI or not.
63
+
{% endhint %}
62
64
63
-
## Changing the repository implementation of a collection
65
+
## Changing the Repository Implementation of a Collection
To help with accessing a repository (default or custom) Umbraco UI Builder has an `IRepositoryFactory` you can inject into your code base. This includes a couple of factory methods to create the repository instances for you.
86
102
Repositories should only be created via the repository factory as there are some injected dependencies that can only be resolved by Umbraco UI Builder.
### Using the `GetRepository<TEntity, TId>()` Method
89
105
90
106
Creates a repository for the given entity type. Umbraco UI Builder will search the configuration for the first section/collection with a configuration for the given entity type. Then it will use that as a repository configuration.
0 commit comments