Class SqliteRoleStore<TRole>
- Namespace
- Hi.SqliteUtils
- Assembly
- HiNc.dll
SQLite-based role store for ASP.NET Core Identity.
public class SqliteRoleStore<TRole> : IRoleStore<TRole>, IQueryableRoleStore<TRole>, IRoleStore<TRole>, IDisposable where TRole : SqliteIdentityRole, new()
Type Parameters
TRoleThe type of role.
- Inheritance
-
SqliteRoleStore<TRole>
- Implements
-
IRoleStore<TRole>IQueryableRoleStore<TRole>IRoleStore<TRole>
- Inherited Members
- Extension Methods
Constructors
SqliteRoleStore(SqliteIdentityStorage)
public SqliteRoleStore(SqliteIdentityStorage storage)
Parameters
storageSqliteIdentityStorage
Properties
Roles
Returns an IQueryable<T> collection of roles.
public IQueryable<TRole> Roles { get; }
Property Value
- IQueryable<TRole>
An IQueryable<T> collection of roles.
Methods
CreateAsync(TRole, CancellationToken)
Creates a new role in a store as an asynchronous operation.
public Task<IdentityResult> CreateAsync(TRole role, CancellationToken cancellationToken)
Parameters
roleTRoleThe role to create in the store.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<IdentityResult>
A Task<TResult> that represents the IdentityResult of the asynchronous query.
DeleteAsync(TRole, CancellationToken)
Deletes a role from the store as an asynchronous operation.
public Task<IdentityResult> DeleteAsync(TRole role, CancellationToken cancellationToken)
Parameters
roleTRoleThe role to delete from the store.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<IdentityResult>
A Task<TResult> that represents the IdentityResult of the asynchronous query.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FindByIdAsync(string, CancellationToken)
Finds the role who has the specified ID as an asynchronous operation.
public Task<TRole> FindByIdAsync(string roleId, CancellationToken cancellationToken)
Parameters
roleIdstringThe role ID to look for.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<TRole>
A Task<TResult> that result of the look up.
FindByNameAsync(string, CancellationToken)
Finds the role who has the specified normalized name as an asynchronous operation.
public Task<TRole> FindByNameAsync(string normalizedRoleName, CancellationToken cancellationToken)
Parameters
normalizedRoleNamestringThe normalized role name to look for.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<TRole>
A Task<TResult> that result of the look up.
GetNormalizedRoleNameAsync(TRole, CancellationToken)
Get a role's normalized name as an asynchronous operation.
public Task<string> GetNormalizedRoleNameAsync(TRole role, CancellationToken cancellationToken)
Parameters
roleTRoleThe role whose normalized name should be retrieved.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<string>
A Task<TResult> that contains the name of the role.
GetRoleIdAsync(TRole, CancellationToken)
Gets the ID for a role from the store as an asynchronous operation.
public Task<string> GetRoleIdAsync(TRole role, CancellationToken cancellationToken)
Parameters
roleTRoleThe role whose ID should be returned.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<string>
A Task<TResult> that contains the ID of the role.
GetRoleNameAsync(TRole, CancellationToken)
Gets the name of a role from the store as an asynchronous operation.
public Task<string> GetRoleNameAsync(TRole role, CancellationToken cancellationToken)
Parameters
roleTRoleThe role whose name should be returned.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<string>
A Task<TResult> that contains the name of the role.
SetNormalizedRoleNameAsync(TRole, string, CancellationToken)
Set a role's normalized name as an asynchronous operation.
public Task SetNormalizedRoleNameAsync(TRole role, string normalizedName, CancellationToken cancellationToken)
Parameters
roleTRoleThe role whose normalized name should be set.
normalizedNamestringThe normalized name to set
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
SetRoleNameAsync(TRole, string, CancellationToken)
Sets the name of a role in the store as an asynchronous operation.
public Task SetRoleNameAsync(TRole role, string roleName, CancellationToken cancellationToken)
Parameters
roleTRoleThe role whose name should be set.
roleNamestringThe name of the role.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
UpdateAsync(TRole, CancellationToken)
Updates a role in a store as an asynchronous operation.
public Task<IdentityResult> UpdateAsync(TRole role, CancellationToken cancellationToken)
Parameters
roleTRoleThe role to update in the store.
cancellationTokenCancellationTokenThe CancellationToken used to propagate notifications that the operation should be canceled.
Returns
- Task<IdentityResult>
A Task<TResult> that represents the IdentityResult of the asynchronous query.