Class EntityFactory<T>

Type Parameters

Hierarchy

Constructors

Properties

db: EntityManager = ...

The owning EntityManager where this factory belongs to

managedType: ManagedType<T> = ...

The managed type of this factory

methods: {
    [methodName: string]: any;
} = ...

Methods that are added to object instances This property is an alias for this factory type prototype

Name

methods

Type declaration

  • [methodName: string]: any
prototype: T = ...
type: Class<T> = ...

Methods

  • Add a method to instances of this factories type

    Returns

    Parameters

    • name: string

      The method name to add

    • fn: Function

      The Method to add

    Returns void

  • Adds methods to instances of this factories type

    Returns

    Parameters

    • methods: {
          [name: string]: Function;
      }

      The methods to add

      • [name: string]: Function

    Returns void

  • Creates a new query for this class

    Returns

    The query builder

    Returns Builder<T>

  • Creates a new instance and sets the DatabaseObject to the given json

    Returns

    instance

    Parameters

    Returns T

  • Loads the instance for the given id, or null if the id does not exists.

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Parameters

    • id: string

      The id to query

    • Optional options: {
          depth?: number | boolean;
          local?: boolean;
          refresh?: boolean;
      }

      The load options

      • Optional depth?: number | boolean

        The object depth which will be loaded. Depth 0 loads only this object, true loads the objects by reachability.

      • Optional local?: boolean

        Indicates whether the local copy (from the entity manager) of an object should be returned if it exists. This value might be stale.

      • Optional refresh?: boolean

        Indicates whether the object should be revalidated (cache bypass).

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<null | T>

  • Creates a new instance of the factory type

    Returns

    A new created instance of *

    Instance

    Parameters

    • Rest ...args: any[]

      Constructor arguments used for instantiation

    Returns T

  • Creates a new instance of the factory type

    Returns

    A new created instance of T

    Parameters

    • Optional args: IArguments | any[]

      Constructor arguments used for instantiation, the constructor will not be called when no arguments are passed

    Returns T

  • Creates a new partial update for this class

    Returns

    A partial update builder for the given entity id

    Parameters

    • id: string

      The id to partial update

    • Optional partialUpdate: Json

      An initial partial update to execute

    Returns EntityPartialUpdateBuilder<T>

  • Gets an unloaded reference for the given id.

    Returns

    An unloaded reference to the object with the given id.

    Parameters

    • id: string

      The id of an object to get a reference for.

    Returns T

Generated using TypeDoc