Class MySqlKitsDataStore
public class MySqlKitsDataStore : IKitDataStore, IEventListener<PlayerLeft>, IAsyncEventListener<PlayerPending>, IHostedService
- Inheritance
-
MySqlKitsDataStore
- Implements
- Inherited Members
Constructors
MySqlKitsDataStore(IServiceProvider, ILogger<MySqlKitsDataStore>)
public MySqlKitsDataStore(IServiceProvider serviceProvider, ILogger<MySqlKitsDataStore> logger)
Parameters
serviceProviderIServiceProviderloggerILogger<MySqlKitsDataStore>
Properties
CacheEnabled
If the cache is being kept up to date.
public bool CacheEnabled { get; }
Property Value
CachedKitsById
Dictionary of cached kits by their internal ID.
public IReadOnlyDictionary<string, Kit> CachedKitsById { get; }
Property Value
CachedKitsByKey
Dictionary of cached kits by their primary key.
public IReadOnlyDictionary<uint, Kit> CachedKitsByKey { get; }
Property Value
Methods
AddKitAsync(string, Class, string?, CSteamID, Action<KitModel>, CancellationToken)
Create a new kit with the given ID and basic information.
public Task<Kit> AddKitAsync(string kitId, Class @class, string? displayName, CSteamID creator, Action<KitModel> createAction, CancellationToken token = default)
Parameters
kitIdstringUnique internal kit ID.
classClassClass of the newly created kit.
displayNamestringOptional sign text for the default language.
creatorCSteamIDPlayer responsible for creating the kit, or default if not applicable.
createActionAction<KitModel>Invoked before the kit is saved to modify the starting options.
tokenCancellationToken
Returns
Exceptions
- ArgumentException
kitIdnot unique orcreateActionthrew an exception.
AddKitAsync(string, Class, string?, CSteamID, Func<KitModel, Task>, CancellationToken)
Create a new kit with the given ID and basic information.
public Task<Kit> AddKitAsync(string kitId, Class @class, string? displayName, CSteamID creator, Func<KitModel, Task> createAction, CancellationToken token = default)
Parameters
kitIdstringUnique internal kit ID.
classClassClass of the newly created kit.
displayNamestringOptional sign text for the default language.
creatorCSteamIDPlayer responsible for creating the kit, or default if none.
createActionFunc<KitModel, Task>Invoked before the kit is saved to modify the starting options.
tokenCancellationToken
Returns
Exceptions
- ArgumentException
kitIdnot unique orcreateActionthrew an exception.
DeleteKitAsync(uint, KitInclude, CancellationToken)
Delete the kit with the given primary key.
public Task<KitModel?> DeleteKitAsync(uint primaryKey, KitInclude include = KitInclude.Base, CancellationToken token = default)
Parameters
primaryKeyuintThe kit to delete.
includeKitIncludeWhat information to include in the returned object.
tokenCancellationToken
Returns
QueryEliteBundleAsync(Func<IQueryable<EliteBundle>, IQueryable<EliteBundle>>, bool, bool, KitInclude, CancellationToken)
Query an elite bundle by it's ID.
public Task<EliteBundle?> QueryEliteBundleAsync(Func<IQueryable<EliteBundle>, IQueryable<EliteBundle>> query, bool includeKits = false, bool includeFaction = false, KitInclude kitListInclude = KitInclude.Default, CancellationToken token = default)
Parameters
queryFunc<IQueryable<EliteBundle>, IQueryable<EliteBundle>>Action against the EliteBundle DbSet<TEntity>.
includeKitsboolIf the list of kits should be included.
includeFactionboolIf the Faction should also be included.
kitListIncludeKitIncludeData to be included in the list of kits, if
includeKitsis true.tokenCancellationToken
Returns
- Task<EliteBundle>
The found bundle, or null if no bundles are found.
QueryEliteBundleAsync(string, bool, bool, KitInclude, CancellationToken)
Query an elite bundle by it's ID.
public Task<EliteBundle?> QueryEliteBundleAsync(string bundleId, bool includeKits = false, bool includeFaction = false, KitInclude kitListInclude = KitInclude.Default, CancellationToken token = default)
Parameters
bundleIdstringThe unique ID of an elite bundle.
includeKitsboolIf the list of kits should be included.
includeFactionboolIf the Faction should also be included.
kitListIncludeKitIncludeData to be included in the list of kits, if
includeKitsis true.tokenCancellationToken
Returns
- Task<EliteBundle>
The found bundle, or null if no bundles are found.
QueryEliteBundleAsync(uint, bool, bool, KitInclude, CancellationToken)
Query an elite bundle by it's primary key.
public Task<EliteBundle?> QueryEliteBundleAsync(uint primaryKey, bool includeKits = false, bool includeFaction = false, KitInclude kitListInclude = KitInclude.Default, CancellationToken token = default)
Parameters
primaryKeyuintThe unique primary key of an elite bundle.
includeKitsboolIf the list of kits should be included.
includeFactionboolIf the Faction should also be included.
kitListIncludeKitIncludeData to be included in the list of kits, if
includeKitsis true.tokenCancellationToken
Returns
- Task<EliteBundle>
The found bundle, or null if no bundles are found.
QueryEliteBundlesAsync(Func<IQueryable<EliteBundle>, IQueryable<EliteBundle>>, bool, bool, KitInclude, CancellationToken)
Query an elite bundle by it's ID.
public Task<IList<EliteBundle>> QueryEliteBundlesAsync(Func<IQueryable<EliteBundle>, IQueryable<EliteBundle>> query, bool includeKits = false, bool includeFaction = false, KitInclude kitListInclude = KitInclude.Default, CancellationToken token = default)
Parameters
queryFunc<IQueryable<EliteBundle>, IQueryable<EliteBundle>>Action against the EliteBundle DbSet<TEntity>.
includeKitsboolIf the list of kits should be included.
includeFactionboolIf the Faction should also be included.
kitListIncludeKitIncludeData to be included in the list of kits, if
includeKitsis true.tokenCancellationToken
Returns
- Task<IList<EliteBundle>>
The found bundle, or null if no bundles are found.
QueryFirstAsync<T>(Func<IQueryable<KitModel>, IQueryable<T>>, KitInclude, CancellationToken)
Query data from a kit other than the kit itself (ex. querying an ID using .Select(x => x.Id)).
public Task<T?> QueryFirstAsync<T>(Func<IQueryable<KitModel>, IQueryable<T>> query, KitInclude include = KitInclude.Base, CancellationToken token = default)
Parameters
queryFunc<IQueryable<KitModel>, IQueryable<T>>Action against the KitModel DbSet<TEntity>.
includeKitIncludeWhat information to include, only applicable when returning KitModel.
tokenCancellationToken
Returns
- Task<T>
The first match to the query.
Type Parameters
TThe type of data to be returned.
QueryKitAsync(string, KitInclude, CancellationToken)
Find a kit by it's kitId.
public Task<Kit?> QueryKitAsync(string kitId, KitInclude include, CancellationToken token = default)
Parameters
kitIdstringincludeKitIncludeWhat type of data to be included in the return value.
tokenCancellationToken
Returns
QueryKitAsync(uint, KitInclude, CancellationToken)
Find a kit by it's primaryKey.
public Task<Kit?> QueryKitAsync(uint primaryKey, KitInclude include, CancellationToken token = default)
Parameters
primaryKeyuintincludeKitIncludeWhat type of data to be included in the return value.
tokenCancellationToken
Returns
QueryKitAsync(KitInclude, Func<IQueryable<KitModel>, IQueryable<KitModel>>, CancellationToken)
Find a kit by a custom where filter.
public Task<Kit?> QueryKitAsync(KitInclude include, Func<IQueryable<KitModel>, IQueryable<KitModel>> query, CancellationToken token = default)
Parameters
includeKitIncludeWhat type of data to be included in the return value.
queryFunc<IQueryable<KitModel>, IQueryable<KitModel>>Action against the KitModel DbSet<TEntity>.
tokenCancellationToken
Returns
QueryKitAsync(KitInclude, Expression<Func<KitModel, bool>>, CancellationToken)
Find a kit by a custom where filter.
public Task<Kit?> QueryKitAsync(KitInclude include, Expression<Func<KitModel, bool>> predicate, CancellationToken token = default)
Parameters
includeKitIncludeWhat type of data to be included in the return value.
predicateExpression<Func<KitModel, bool>>Filter applied using the where filter.
tokenCancellationToken
Returns
QueryKitsAsync(KitInclude, IList<Kit>, Func<IQueryable<KitModel>, IQueryable<KitModel>>, CancellationToken)
Find kits by a custom queryable filter.
public Task<int> QueryKitsAsync(KitInclude include, IList<Kit> output, Func<IQueryable<KitModel>, IQueryable<KitModel>> query, CancellationToken token = default)
Parameters
includeKitIncludeWhat type of data to be included in the return value.
outputIList<Kit>List to output matching kits to. It will not be cleared, only appended to.
queryFunc<IQueryable<KitModel>, IQueryable<KitModel>>Action against the KitModel DbSet<TEntity>.
tokenCancellationToken
Returns
QueryKitsAsync(KitInclude, IList<Kit>, Expression<Func<KitModel, bool>>, CancellationToken)
Find kits by a custom where filter.
public Task<int> QueryKitsAsync(KitInclude include, IList<Kit> output, Expression<Func<KitModel, bool>> predicate, CancellationToken token = default)
Parameters
includeKitIncludeWhat type of data to be included in the return value.
outputIList<Kit>List to output matching kits to. It will not be cleared, only appended to.
predicateExpression<Func<KitModel, bool>>Filter applied using the where filter.
tokenCancellationToken
Returns
QueryKitsAsync(KitInclude, Func<IQueryable<KitModel>, IQueryable<KitModel>>, CancellationToken)
Find kits by a custom queryable filter.
public Task<Kit[]> QueryKitsAsync(KitInclude include, Func<IQueryable<KitModel>, IQueryable<KitModel>> query, CancellationToken token = default)
Parameters
includeKitIncludeWhat type of data to be included in the return value.
queryFunc<IQueryable<KitModel>, IQueryable<KitModel>>Action against the KitModel DbSet<TEntity>.
tokenCancellationToken
Returns
QueryKitsAsync(KitInclude, Expression<Func<KitModel, bool>>, CancellationToken)
Find kits by a custom where filter.
public Task<Kit[]> QueryKitsAsync(KitInclude include, Expression<Func<KitModel, bool>> predicate, CancellationToken token = default)
Parameters
includeKitIncludeWhat type of data to be included in the return value.
predicateExpression<Func<KitModel, bool>>Filter applied using the where filter.
tokenCancellationToken
Returns
QueryListAsync<T>(Func<IQueryable<KitModel>, IQueryable<T>>, KitInclude, CancellationToken)
Query data from a kit other than the kit itself (ex. querying all IDs using .Select(x => x.Id)).
public Task<List<T>> QueryListAsync<T>(Func<IQueryable<KitModel>, IQueryable<T>> query, KitInclude include = KitInclude.Base, CancellationToken token = default)
Parameters
queryFunc<IQueryable<KitModel>, IQueryable<T>>Action against the KitModel DbSet<TEntity>.
includeKitIncludeWhat information to include, only applicable when returning KitModel.
tokenCancellationToken
Returns
Type Parameters
TThe type of data to be returned.
UpdateKitAsync(uint, KitInclude, Action<KitModel>, CSteamID, CancellationToken)
Modify the kit with the given primaryKey.
public Task<Kit?> UpdateKitAsync(uint primaryKey, KitInclude include, Action<KitModel> updateAction, CSteamID updater, CancellationToken token = default)
Parameters
primaryKeyuintThe kit to modify.
includeKitIncludeWhat information to include.
updateActionAction<KitModel>Callback to apply the modifications.
updaterCSteamIDPlayer who is updating the kit, or default if not applicable.
tokenCancellationToken
Returns
UpdateKitAsync(uint, KitInclude, Func<KitModel, Task>, CSteamID, CancellationToken)
Modify the kit with the given primaryKey.
public Task<Kit?> UpdateKitAsync(uint primaryKey, KitInclude include, Func<KitModel, Task> updateAction, CSteamID updater, CancellationToken token = default)
Parameters
primaryKeyuintThe kit to modify.
includeKitIncludeWhat information to include.
updateActionFunc<KitModel, Task>Callback to apply the modifications.
updaterCSteamIDPlayer who is updating the kit, or default if not applicable.
tokenCancellationToken
Returns
Events
KitAdded
Invoked when a new kit is added.
public event Action<Kit>? KitAdded
Event Type
KitRemoved
Invoked when a kit is fully deleted.
public event Action<KitModel>? KitRemoved
Event Type
KitUpdated
Invoked when a kit's properties are updated.
public event Action<Kit>? KitUpdated