Table of Contents

Interface IAppDataTyped

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

Data object of an App in Typed mode

[PublicApi]
public interface IAppDataTyped : IDataSource, IDataSourceLinkable, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog
Inherited Members

Remarks

Added v17

Methods

Create(string, Dictionary<string, object>, string, ITarget)

Create a new entity in the storage.

IEntity Create(string contentTypeName, Dictionary<string, object> values, string userName = null, ITarget target = null)

Parameters

contentTypeName string

The type name

values Dictionary<string, object>

a dictionary of values to be stored

userName string

the current user name - will be logged as the author

target ITarget

information if this new item is to be metadata for something

Returns

IEntity

Remarks

Changed in 2sxc 10.30 - now returns the id of the created items

Create(string, IEnumerable<Dictionary<string, object>>, string)

Create a bunch of new entities in one single call (much faster, because cache doesn't need to repopulate in the mean time).

IEnumerable<IEntity> Create(string contentTypeName, IEnumerable<Dictionary<string, object>> multiValues, string userName = null)

Parameters

contentTypeName string

The type name

multiValues IEnumerable<Dictionary<string, object>>

many dictionaries, each will become an own item when stored

userName string

the current user name - will be logged as the author

Returns

IEnumerable<IEntity>

Remarks

You can't create items which are metadata with this, for that, please use the Create-one overload
Changed in 2sxc 10.30 - now returns the id of the created items

Delete(int, string)

Delete an existing item

void Delete(int entityId, string userName = null)

Parameters

entityId int

The item ID

userName string

the current user name - will be logged as the author of the change

GetAll<T>(NoParamOrder, string, bool)

Get all data from the app of the specified type. It will detect the expected Content-Type based on the name of the class used. So in most cases you will not add any parameters.

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

Parameters

protector NoParamOrder

see Convention: Named Parameters

typeName string

optional type name

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 get and convert to - usually inheriting CustomItem

Remarks

Released in v17.03.

GetContentType(string)

Get a single content type by name (display name or NameId).

IContentType GetContentType(string name)

Parameters

name string

the name, either the normal name or the NameId which looks like a GUID

Returns

IContentType

Remarks

Added v17

GetContentTypes()

All content types of the app.

IEnumerable<IContentType> GetContentTypes()

Returns

IEnumerable<IContentType>

Remarks

Added v17

GetOne<T>(Guid, NoParamOrder, bool)

Get a single item from the app of the specified type.

T GetOne<T>(Guid id, NoParamOrder protector = default, bool skipTypeCheck = false) where T : class, ITypedItemWrapper16, ITypedItem, new()

Parameters

id 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 get and convert to - usually inheriting CustomItem

Remarks

Released in v17.03.

GetOne<T>(int, NoParamOrder, bool)

Get a single item from the app of the specified type.

T GetOne<T>(int id, NoParamOrder protector = default, bool skipTypeCheck = false) where T : class, ITypedItemWrapper16, ITypedItem, new()

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 get and convert to - usually inheriting CustomItem

Remarks

Released in v17.03.

Update(int, Dictionary<string, object>, string)

Update an existing item.

void Update(int entityId, Dictionary<string, object> values, string userName = null)

Parameters

entityId int

The item ID

values Dictionary<string, object>

a dictionary of values to be updated

userName string

the current user name - will be logged as the author of the change