Table of Contents

Interface IAppData

Namespace
ToSic.Eav.Apps
Assembly
ToSic.Eav.Apps.dll

An App-DataSource which also provides direct commands to edit/update/delete data.

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

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

GetCustomMetadata<TKey>(TKey, string)

Get metadata of TargetType.Custom - which is the most common way your code will need Metadata.

IEnumerable<IEntity> GetCustomMetadata<TKey>(TKey key, string contentTypeName = null)

Parameters

key TKey

The target identifier - a number, string or Guid

contentTypeName string

Optional name of Content-Type, if you only want items of a specific type

Returns

IEnumerable<IEntity>

Type Parameters

TKey

Key data type

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