Table of Contents

Interface ITypedQuery

Namespace
ToSic.Sxc.Data
Assembly
ToSic.Sxc.Apps.dll

Query object from GetQuery(string?, NoParamOrder, IDataSourceLinkable?, object?) an App in Typed mode, with quick get-and-convert-helpers such as GetAll or GetOne.

[WorkInProgressApi("Still WIP")]
public interface ITypedQuery : IDataSource, IDataSourceLinkable, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog
Inherited Members

Remarks

WIP v20

Methods

GetAll<T>(NoParamOrder, string?, bool)

Get all data from the app of the specified type in a stream with the same name (or "Default"). It will detect the expected stream name based on the name of the class used.

So in most cases you will not add any parameters except for the type parameter T. This is usually a type of your AppCode.Data namespace.

IEnumerable<T>? GetAll<T>(NoParamOrder protector = default, string? typeName = null, bool nullIfNotFound = false) where T : class, ICanWrapData

Parameters

protector NoParamOrder

see Convention: Named Parameters

typeName string

optional type name which is used as the stream name when retrieving the data, as each stream contains entities of one type.

nullIfNotFound bool

if set, will return null if the type doesn't exist - default is empty list.

Returns

IEnumerable<T>

Type Parameters

T

The type to convert to - usually inheriting Custom.Data.CustomItem or CustomModel

Remarks

WIP in v20.00

GetOne<T>(Guid, NoParamOrder, bool)

Get a single item from the query with the specified GUID.

T? GetOne<T>(Guid guid, NoParamOrder protector = default, bool skipTypeCheck = false) where T : class, ICanWrapData

Parameters

guid Guid

the ID as GUID

protector NoParamOrder

see Convention: Named Parameters

skipTypeCheck bool

allow get even if the Content-Type of the item with the ID doesn't match the type specified in the parameter T

Returns

T

Type Parameters

T

The type to convert to - usually inheriting Custom.Data.CustomItem or CustomModel

Remarks

WIP in v20.00

GetOne<T>(int, NoParamOrder, bool)

Get a single item from the query with the specified ID.

T? GetOne<T>(int id, NoParamOrder protector = default, bool skipTypeCheck = false) where T : class, ICanWrapData

Parameters

id int

the ID as an int

protector NoParamOrder

see Convention: Named Parameters

skipTypeCheck bool

allow get even if the Content-Type of the item with the ID doesn't match the type specified in the parameter T

Returns

T

Type Parameters

T

The type to convert to - usually inheriting Custom.Data.CustomItem or CustomModel

Remarks

WIP in v20.00