Interface IAppData
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, IMetadataSource
- 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
stringThe type name
values
Dictionary<string, object>a dictionary of values to be stored
userName
stringthe current username - will be logged as the author
target
ITargetinformation if this new item is to be metadata for something
Returns
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 meantime).
IEnumerable<IEntity> Create(string contentTypeName, IEnumerable<Dictionary<string, object?>> multiValues, string? userName = null)
Parameters
contentTypeName
stringThe type name
multiValues
IEnumerable<Dictionary<string, object>>many dictionaries, each will become an own item when stored
userName
stringthe current username - will be logged as the author
Returns
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
intThe item ID
userName
stringthe current username - will be logged as the author of the change
GetContentType(string)
Get a single content type by name (display name or NameId).
IContentType? GetContentType(string name)
Parameters
name
stringthe name, either the normal name or the NameId which looks like a GUID
Returns
Remarks
Added v20
GetContentTypes()
All content types of the app.
IEnumerable<IContentType> GetContentTypes()
Returns
Remarks
- Added v20
- Implemented as a method, so later we can apply filters etc. as additional parameters
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
TKeyThe target identifier - a number, string or Guid
contentTypeName
stringOptional name of Content-Type, if you only want items of a specific type
Returns
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
intThe item ID
values
Dictionary<string, object>a dictionary of values to be updated
userName
stringthe current username - will be logged as the author of the change