klyn.data.EntityManager.find
method

    public find<T, TId>(id as TId) as T:

Description

Finds an entity by its mapped identity.

The identity map is consulted before provider I/O. Repeated calls and KQL materialization therefore return the same managed instance. The compiler accepts `find<T>(id)` and infers `TId` from `@Id`.

Parameters

Parameter | Description
--- | ---
`<T>` | Entity type.
`<TId>` | Effective identity type.
`id` | Identity to find.

Returns

Managed entity, or `null` when absent.

Throws

- EntityMappingException when the key type does not match.

Example

    user = manager.find<User>(42)
    if user is not null:
    print(user.login)