---
title: "Entity factory"
slug: "entity-factory"
abstract: "Overview of the Entity factory used to create entity instances from a specific entity definition."
---
# Entity factory

The entity factory creates entity instances from a specific entity definition.

Entities are complex objects and their members can change at runtime by modifying the entity definition. It is therefore required to create instances using a factory. The factory resolves the entity definition and configures the entity instance with the correct members and configuration. A new instance always contains all members.

> [!note]
> The `client` variable in the following code examples refers to the `IMClient` instance. When using the Web SDK, the variable name can be chosen freely, but it is also called `client` at instantiation in the documentation.

## Create entities

Creating entities can be done using the `CreateAsync` method which returns a new entity instance. It is very important to create the entity with the right cultures (optional argument), because this cannot be changed without reloading the entity.

For example, creating a new Asset entity in the default culture can be done like this:

```shell
IEntity asset = await MClient.EntityFactory.CreateAsync(Constants.Asset.DefinitionName);

```

The entity can be created by passing the entity definition name or the entity definition instance.

> [!note]
> The entity instance is not persisted. The factory only creates an object. If the entity needs to be persisted, use the `SaveAsync` on the `IEntitiesClient`.