Table of Contents

Interface IDataFactory

Namespace
ToSic.Eav.Data.Build
Assembly
ToSic.Eav.Data.Build.dll

A data builder which will generate items for a specific type. In many cases it will also take care of auto increasing the id and more.

[PublicApi]
public interface IDataFactory : IServiceWithSetup<DataFactoryOptions>
Inherited Members

Remarks

  • Added in v15 to replace the previous IDataBuilder
  • v22 changed some internals to be more flexible, assume not intensively used so no issues expected

Properties

IdCounter

A counter for the ID in case the data provided doesn't have an ID to use. Default is 1. Negative numbers are possible.

int IdCounter { get; }

Property Value

int

Methods

Create(IDictionary<string, object?>, int, Guid, DateTime, DateTime, EntityPartsLazy?)

Create a single entity based on values passed in.

IEntity Create(IDictionary<string, object?> values, int id = 0, Guid guid = default, DateTime created = default, DateTime modified = default, EntityPartsLazy? partsLazy = null)

Parameters

values IDictionary<string, object>
id int
guid Guid
created DateTime
modified DateTime
partsLazy EntityPartsLazy

Returns

IEntity

Create(IRawData)

Create an entity from a single IRawEntity

IEntity Create(IRawData item)

Parameters

item IRawData

Returns

IEntity

Create<T>(IEnumerable<T>)

Create a complete list of IRawEntitys. This is the method to use when you don't plan on doing any post-processing.

If you need post-processing, call Prepare instead and finish using WrapUp.

IImmutableList<IEntity> Create<T>(IEnumerable<T> list) where T : class, IRawData

Parameters

list IEnumerable<T>

Returns

IImmutableList<IEntity>

Type Parameters

T