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

int IdCounter { get; }

Property Value

int

Relationships

TODO:

ILookup<object, IEntity> Relationships { get; }

Property Value

ILookup<object, IEntity>

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(IConvertibleToRawEntity)

Create an entity from a single ToSic.Eav.Data.Raw.Sys.IRawEntity

IEntity Create(IConvertibleToRawEntity item)

Parameters

item IConvertibleToRawEntity

Returns

IEntity

Create<T>(IEnumerable<T>)

Create a complete list of ToSic.Eav.Data.Raw.Sys.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, IConvertibleToRawEntity

Parameters

list IEnumerable<T>

Returns

IImmutableList<IEntity>

Type Parameters

T