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.
Assembly: ToSic.Eav.Core.dll
Syntax
[PublicApi]
public interface IDataFactory
Properties
|
Improve this Doc
View Source
ContentType
The generated ContentType.
This will only be generated once, for better performance.
Declaration
IContentType ContentType { get; }
Property Value
|
Improve this Doc
View Source
IdCounter
A counter for the ID in case the data provided doesn't have an ID to use.
Default is 1
Declaration
Property Value
|
Improve this Doc
View Source
Relationships
Declaration
ILookup<object, IEntity> Relationships { get; }
Property Value
Methods
|
Improve this Doc
View Source
Create(IDictionary<string, object>, int, Guid, DateTime, DateTime)
Create a single entity based on values passed in.
Declaration
IEntity Create(IDictionary<string, object> values, int id = 0, Guid guid = default, DateTime created = default, DateTime modified = default)
Parameters
Returns
|
Improve this Doc
View Source
Create(IRawEntity)
Declaration
IEntity Create(IRawEntity rawEntity)
Parameters
Returns
|
Improve this Doc
View Source
Create<T>(IEnumerable<IHasRawEntity<T>>)
Build a complete stream 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
.
Declaration
IImmutableList<IEntity> Create<T>(IEnumerable<IHasRawEntity<T>> list) where T : IRawEntity
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
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
.
Declaration
IImmutableList<IEntity> Create<T>(IEnumerable<T> list) where T : IRawEntity
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
New(string, DataFactoryOptions, ILookup<object, IEntity>, RawConvertOptions)
Declaration
IDataFactory New(string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", DataFactoryOptions options = null, ILookup<object, IEntity> relationships = null, RawConvertOptions rawConvertOptions = null)
Parameters
Returns
Type |
Description |
IDataFactory |
Itself, to make call chaining easier
|
|
Improve this Doc
View Source
Prepare<T>(IEnumerable<IHasRawEntity<T>>)
This will create IEntity but return it in a dictionary mapped to the original.
This is useful when you intend to do further processing and need to know which original matches the generated entity.
IMPORTANT: WIP
THIS ALREADY RUNS FullClone, so the resulting IEntities are properly modifiable and shouldn't be cloned again
Declaration
IList<EntityPair<T>> Prepare<T>(IEnumerable<IHasRawEntity<T>> data) where T : IRawEntity
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Prepare<T>(IEnumerable<T>)
This will create IEntity but return it in a dictionary mapped to the original.
This is useful when you intend to do further processing and need to know which original matches the generated entity.
IMPORTANT: WIP
THIS ALREADY RUNS FullClone, so the resulting IEntities are properly modifiable and shouldn't be cloned again
Declaration
IList<EntityPair<T>> Prepare<T>(IEnumerable<T> list) where T : IRawEntity
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Prepare<T>(IHasRawEntity<T>)
For objects which delegate the IRawEntity to a property.
Declaration
EntityPair<T> Prepare<T>(IHasRawEntity<T> withRawEntity) where T : IRawEntity
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Prepare<T>(T)
Declaration
EntityPair<T> Prepare<T>(T rawEntity) where T : IRawEntity
Parameters
Type |
Name |
Description |
T |
rawEntity |
|
Returns
Type Parameters
|
Improve this Doc
View Source
WrapUp(IEnumerable<ICanBeEntity>)
Finalize the work of building something, using prepared materials.
Declaration
IImmutableList<IEntity> WrapUp(IEnumerable<ICanBeEntity> rawList)
Parameters
Returns