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, 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
stringThe type name
values
Dictionary<string, object>a dictionary of values to be stored
userName
stringthe current user name - 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 mean time).
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 user name - 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 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
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 user name - will be logged as the author of the change