> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-ui-builder/13.latest/filtering/data-views/data-views-builders.md).

# Data Views Builders

Configuring data views builders in Umbraco UI Builder, the backoffice UI builder for Umbraco.

Data views builders allow you to create a collection data views list dynamically at run time. By default, Umbraco UI Builder will use the hard-coded data views defined in your Umbraco UI Builder config. However, if you need to build your data views list dynamically, then this is when you'd use a data views builder.

When Umbraco UI Builder resolves a data views builder it will attempt to do so from the global DI container. This means you can inject any dependencies that you require for your builder. If there is no type defined in the DI container, Umbraco UI Builder will fall-back to manually instantiating a new instance of value mapper.

## Defining a data views builder

To define a data views builder you can create a class that inherits from the base class `DataViewsBuilder<TEntityType>` and implements the abstract methods.

```csharp
// Example
public class PersonDataViewsBuilder : DataViewsBuilder<Person>
{
    public override IEnumerable<DataViewSummary> GetDataViews()
    {
        // Generate and return a list of data views
    }

    public override Expression<Func<Person, bool>> GetDataViewWhereClause(string dataViewAlias)
    {
        // Return a where clause expression for the supplied data view alias
    }
}
```

The required methods are:

* **GetDataViews:** Returns the list of data views to choose from.
* **GetDataViewWhereClause:** Returns the boolean **where clause** expression for the given data views alias.

## Setting the data views builder of a collection

Setting a data views builder is controlled via the [collections](/umbraco-ui-builder/13.latest/collections/overview.md) configuration.

### **SetDataViewsBuilder\<TDataViewsBuilder>() : CollectionConfigBuilder\<TEntityType>**

Sets the collections data views builder which allows you to define the data views dynamically at run time.

```csharp
// Example
collectionConfig.SetDataViewsBuilder<PersonDataViewsBuilder>();
```

### **SetDataViewsBuilder(Type dataViewsBuilderType) : CollectionConfigBuilder\<TEntityType>**

Sets the collections data views builder which allows you to define the data views dynamically at run time.

```csharp
// Example
collectionConfig.SetDataViewsBuilder(typeof(PersonDataViewsBuilder));
```

### **SetDataViewsBuilder(DataViewsBuilder\<TEntityType> dataViewsBuilder) : CollectionConfigBuilder\<TEntityType>**

Sets the collections data views builder which allows you to define the data views dynamically at run time.

```csharp
// Example
collectionConfig.SetDataViewsBuilder(new PersonDataViewsBuilder());
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/umbraco-ui-builder/13.latest/filtering/data-views/data-views-builders.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
