new

open override fun new(id: String, factory: () -> T): T

Creates a new entity in storage with the given identifier.

Return

The created entity.

Parameters

id

The unique identifier for the entity.

factory

A lambda that produces the initial entity when called.

Throws

if an entity with the given id already exists.