• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API
Search Results for

    Show / Hide Table of Contents

    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.

    Namespace: ToSic.Eav.Data.Build
    Assembly: ToSic.Eav.Core.dll
    Syntax
    [PublicApi]
    public interface IDataFactory
    Remarks
    • Added in v15 to replace the previous IDataBuilder

    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
    Type Description
    IContentType
    | 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
    int IdCounter { get; }
    Property Value
    Type Description
    int
    | Improve this Doc View Source

    Relationships

    TODO:

    Declaration
    ILookup<object, IEntity> Relationships { get; }
    Property Value
    Type Description
    ILookup<object, IEntity>

    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
    Type Name Description
    IDictionary<string, object> values
    int id
    Guid guid
    DateTime created
    DateTime modified
    Returns
    Type Description
    IEntity
    | Improve this Doc View Source

    Create(IRawEntity)

    Create an entity from a single IRawEntity

    Declaration
    IEntity Create(IRawEntity rawEntity)
    Parameters
    Type Name Description
    IRawEntity rawEntity
    Returns
    Type Description
    IEntity
    | 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
    Type Name Description
    IEnumerable<IHasRawEntity<T>> list
    Returns
    Type Description
    IImmutableList<IEntity>
    Type Parameters
    Name Description
    T
    | 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
    Type Name Description
    IEnumerable<T> list
    Returns
    Type Description
    IImmutableList<IEntity>
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    New(string, DataFactoryOptions, ILookup<object, IEntity>, RawConvertOptions)

    Spawn a new IDataFactory with an initial configuration. This returns a new IDataFactory and will not modify the original/parent. Uses the Spawn New convention.

    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
    Type Name Description
    string noParamOrder

    see Convention: Named Parameters

    DataFactoryOptions options

    All the options which are relevant for the DataFactory

    ILookup<object, IEntity> relationships
    RawConvertOptions rawConvertOptions

    Optional special options which create-raw might use

    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
    Type Name Description
    IEnumerable<IHasRawEntity<T>> data
    Returns
    Type Description
    IList<EntityPair<T>>
    Type Parameters
    Name Description
    T
    | 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
    Type Name Description
    IEnumerable<T> list
    Returns
    Type Description
    IList<EntityPair<T>>
    Type Parameters
    Name Description
    T
    | 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
    Type Name Description
    IHasRawEntity<T> withRawEntity
    Returns
    Type Description
    EntityPair<T>
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Prepare<T>(T)

    For objects which themselves are IRawEntity

    Declaration
    EntityPair<T> Prepare<T>(T rawEntity) where T : IRawEntity
    Parameters
    Type Name Description
    T rawEntity
    Returns
    Type Description
    EntityPair<T>
    Type Parameters
    Name Description
    T
    | 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
    Type Name Description
    IEnumerable<ICanBeEntity> rawList
    Returns
    Type Description
    IImmutableList<IEntity>
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX