Interface IDataFactory
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
Relationships
TODO:
ILookup<object, IEntity> Relationships { get; }
Property Value
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
valuesIDictionary<string, object>idintguidGuidcreatedDateTimemodifiedDateTimepartsLazyEntityPartsLazy
Returns
Create(IConvertibleToRawEntity)
Create an entity from a single ToSic.Eav.Data.Raw.Sys.IRawEntity
IEntity Create(IConvertibleToRawEntity item)
Parameters
itemIConvertibleToRawEntity
Returns
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
listIEnumerable<T>
Returns
Type Parameters
T