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
Copy file name to clipboardExpand all lines: 15/umbraco-ui-builder/getting-started/configuration.md
+33-6Lines changed: 33 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,39 @@
1
1
---
2
-
description: Learn how to configure Umbraco UI Builder using the extension method.
2
+
description: Learn how to configure Umbraco UI Builder in your project using two different approaches.
3
3
---
4
4
5
5
# Configuration
6
6
7
-
You can configure Umbraco UI Builder using the `AddUIBuilder` extension method in `Program.cs`.
7
+
You can configure Umbraco UI Builder either via a Composer or in the`Program.cs`.
8
8
9
-
## Using `AddUIBuilder`
9
+
## Option 1: Configuring via a Composer
10
+
11
+
A Composer is a common approach for registering and configuring services in Umbraco during application startup.
12
+
13
+
To configure Umbraco UI Builder via a Composer:
14
+
15
+
1. Create a file called `UIBuilderComposer.cs` in your project.
16
+
2. Implement the `IComposer` interface and add the configuration inside the `Compose` method:
17
+
18
+
```csharp
19
+
usingUmbraco.Cms.Core.Composing;
20
+
usingUmbraco.UIBuilder.Extensions;
21
+
22
+
publicclassUIBuilderComposer : IComposer
23
+
{
24
+
publicvoidCompose(IUmbracoBuilderbuilder)
25
+
{
26
+
builder.AddUIBuilder(cfg=>
27
+
{
28
+
// Apply your configuration here
29
+
});
30
+
}
31
+
}
32
+
```
33
+
34
+
## Option 2: Configuring via `Program.cs`
35
+
36
+
You can also configure Umbraco UI Builder directly in `Program.cs` using the `AddUIBuilder` extension method.
10
37
11
38
To configure Umbraco UI Builder:
12
39
@@ -26,8 +53,8 @@ builder.CreateUmbracoBuilder()
26
53
.Build();
27
54
```
28
55
29
-
{% hint style="info" %}
30
-
If you want an example configuration, see the **Configure Umbraco UI Builder** section in the [Creating your First Integration](../guides/creating-your-first-integration.md) article.
31
-
{% endhint %}
56
+
## Example Configuration
57
+
58
+
For a complete sample configuration, see the [Creating your First Integration](../guides/creating-your-first-integration.md) article.
32
59
33
60
The `AddUIBuilder` method accepts a delegate function, allowing you to configure your solution using fluent APIs.
Copy file name to clipboardExpand all lines: 15/umbraco-ui-builder/guides/creating-your-first-integration.md
+24-8Lines changed: 24 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,21 @@
2
2
description: Creating your first integration with Umbraco UI Builder.
3
3
---
4
4
5
-
# Creating your first integration
5
+
# Creating Your First Umbraco UI Builder Integration
6
6
7
-
In this guide, you will find the necessary steps needed for a basic implementation using Umbraco UI Builder to manage a single custom database table.
7
+
This guide walks you through a basic implementation of Umbraco UI Builder to manage a custom database table.
8
+
9
+
{% hint style="info" %}
10
+
By default, Umbraco UI Builder uses a database for data storage. However, you can configure this using a custom [Repository](../advanced/repositories.md) class instead.
11
+
{% endhint %}
8
12
9
13
## Setting Up the Database
10
14
11
-
Out of the box, Umbraco UI Builder works using PetaPoco as the persistence layer, as this is what ships with Umbraco. If you prefer, it is possible to use a custom [Repository](../advanced/repositories.md). However, for getting started, it is expected that you are using this default strategy.
15
+
Umbraco UI Builder uses PetaPoco as its default persistence layer.
16
+
17
+
In this section, you will create a `Person` table to store data.
12
18
13
-
In this section, let's create a `Person` table to store data. Run the following script in SQL Server Management Studio (SSMS) to create the `Person` table.
19
+
To create a `Person` table, run the following script in SQL Server Management Studio (SSMS).
14
20
15
21
```sql
16
22
CREATE TABLE [Person] (
@@ -24,16 +30,16 @@ CREATE TABLE [Person] (
24
30
);
25
31
```
26
32
27
-
This script creates a table for storing people’s details. You might want to populate it with some dummy data for testing.
33
+
This script creates a table for storing people’s details. You may want to populate it with some dummy data for testing.
28
34
29
35
## Setting Up the Model
30
36
31
-
With the database table set up, create the associated Poco model in the project.
37
+
With the database table created, define the `Person`model in your project.
32
38
33
39
To create a Model:
34
40
35
41
1. Create a new folder called **Models** in your project.
36
-
2.Create a new class file called `Person.cs`.
42
+
2.Add a new class file called `Person.cs`.
37
43
3. Add the following code:
38
44
39
45
```csharp
@@ -59,6 +65,14 @@ public class Person
59
65
60
66
With the database and model set up, it is time to configure Umbraco UI Builder to work with the `Person` model. This will allow you to manage `Person` entities from the Umbraco backoffice.
61
67
68
+
{% hint style="info" %}
69
+
You can configure Umbraco UI Builder either through a Composer or by using the `AddUIBuilder` extension method in `Program.cs`.
70
+
{% endhint %}
71
+
72
+
The following steps cover the `Program.cs` approach. For more details, including configuring via a Composer, see the the [Configuration](../getting-started/configuration.md) article.
73
+
74
+
### Configuring via `Program.cs`
75
+
62
76
1. Open the `Program.cs` file in your project.
63
77
2. Locate the `CreateUmbracoBuilder()` method.
64
78
3. Add `AddUIBuilder` before `AddComposers()`.
@@ -75,7 +89,9 @@ builder.CreateUmbracoBuilder()
75
89
.Build();
76
90
```
77
91
78
-
For this guide, the following configuration is used:
92
+
### Example Configuration
93
+
94
+
Here’s an example configuration defining a section, a list view, and an editor for managing `Person` entities:
0 commit comments