Interface IAppDataTyped
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
contentTypeNamestringThe type name
valuesDictionary<string, object>a dictionary of values to be stored
userNamestringthe current username - will be logged as the author
targetITargetinformation 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
contentTypeNamestringThe type name
multiValuesIEnumerable<Dictionary<string, object>>many dictionaries, each will become an own item when stored
userNamestringthe 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
entityIdintThe item ID
userNamestringthe current username - 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 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
protectorNoParamOrdertypeNamestringoptional type name which is used as the stream name when retrieving the data, as each stream contains entities of one type.
nullIfNotFoundboolif set, will return null if the type doesn't exist - default is empty list.
Returns
- IEnumerable<T>
Type Parameters
TThe type to get and convert to - usually inheriting
Custom.Data.CustomItem
Remarks
Released in v17.03.
GetContentType(string)
Get a single content type by name (display name or NameId).
IContentType? GetContentType(string name)
Parameters
namestringthe name, either the normal name or the NameId which looks like a GUID
Returns
Remarks
Added v17
GetContentTypes()
All content types of the app.
IEnumerable<IContentType> GetContentTypes()
Returns
Remarks
- Added v17
- Implemented as a method, so later we can apply filters etc. as additional parameters
GetOne<T>(Guid, NoParamOrder, bool)
Get a single item from the app with the specified GUID.
T? GetOne<T>(Guid id, NoParamOrder protector = default, bool skipTypeCheck = false) where T : class, ICanWrapData
Parameters
idGuidthe ID as GUID
protectorNoParamOrderskipTypeCheckboolallow 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
TThe type to convert to - usually inheriting
Custom.Data.CustomItemorCustomModel
Remarks
Released in v17.03.
GetOne<T>(int, NoParamOrder, bool)
Get a single item from the app with the specified ID.
T? GetOne<T>(int id, NoParamOrder protector = default, bool skipTypeCheck = false) where T : class, ICanWrapData
Parameters
idintthe ID as an int
protectorNoParamOrderskipTypeCheckboolallow 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
TThe type to convert to - usually inheriting
Custom.Data.CustomItemorCustomModel
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
entityIdintThe item ID
valuesDictionary<string, object>a dictionary of values to be updated
userNamestringthe current username - will be logged as the author of the change