Class PersonStore<TPerson, TContext>
Represents a new instance of a persistence store for the specified person type.
Inherited Members
Namespace: IRM.AspNetCore.Identity.EntityFrameworkCore
Assembly: IRM.AspNetCore.Identity.EntityFrameworkCore.dll
Syntax
public class PersonStore<TPerson, TContext> : IPersonEmailStore<TPerson>, IPersonStore<TPerson>, IDisposable, IUseExecutionStrategy where TPerson : class, IPerson where TContext : DbContext
Type Parameters
TPerson
The type representing a person. |
TContext
The type of the data context class used to access the store. |
Constructors
PersonStore(TContext, ILogger<PersonStore<TPerson, TContext>>, IAsyncEventSourceRepository, IdentityErrorDescriber)
Creates a new instance of PersonStore<TPerson, TContext>.
Declaration
public PersonStore(TContext context, ILogger<PersonStore<TPerson, TContext>> logger, IAsyncEventSourceRepository eventSourceRepository = null, IdentityErrorDescriber describer = null)
Parameters
TContext
context
The context used to access the store. |
Microsoft.Extensions.Logging.ILogger<PersonStore<TPerson, TContext>>
logger
The logger used to log messages, warnings and errors. |
IAsyncEventSourceRepository
eventSourceRepository
The IAsyncEventSourceRepository used to handle events. |
Microsoft.AspNetCore.Identity.IdentityErrorDescriber
describer
The Microsoft.AspNetCore.Identity.IdentityErrorDescriber used to describe store errors. |
Properties
Context
Gets the database context for this store.
Declaration
public TContext Context { get; }
Property Value
TContext
|
EventSourceRepository
Gets the IAsyncEventSourceRepository used to handle events.
Declaration
protected IAsyncEventSourceRepository EventSourceRepository { get; }
Property Value
IAsyncEventSourceRepository
|
Logger
Gets the logger used to log messages, warnings and errors.
Declaration
protected ILogger Logger { get; }
Property Value
Microsoft.Extensions.Logging.ILogger
|
Methods
CreateAsync(TPerson, CancellationToken)
Creates the specified person
in the person store.
Declaration
public virtual async Task<IdentityResult> CreateAsync(TPerson person, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TPerson
person
The person to create. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<IdentityResult>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult of the creation operation. |
Implements
DeleteAsync(TPerson, CancellationToken)
Deletes the specified person
in the person store.
Declaration
public virtual async Task<IdentityResult> DeleteAsync(TPerson person, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TPerson
person
The person to delete. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<IdentityResult>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult of the deletion operation. |
Implements
Dispose()
Releases all resources used by the store.
Declaration
public void Dispose()
Implements
Dispose(Boolean)
Releases the unmanaged resources used by the organisation manager and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Boolean
disposing
true to release both managed and unmanaged resources; false to release only unmanaged resources. |
FindByEmailAsync(String, CancellationToken)
Gets the person, if any, associated with the specified, email address.
Declaration
public virtual Task<TPerson> FindByEmailAsync(string email, CancellationToken cancellationToken = default(CancellationToken))
Parameters
String
email
The email address to return the person for. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<TPerson>
The task object containing the results of the asynchronous lookup operation, the person if any associated with the specified email address. |
Implements
FindByIdAsync(Guid, CancellationToken)
Finds and returns a person, if any, who has the specified personId
.
Declaration
public virtual Task<TPerson> FindByIdAsync(Guid personId, CancellationToken cancellationToken = default(CancellationToken))
Parameters
System.Guid
personId
The person ID to search for. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<TPerson>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing the person matching the specified |
Implements
FindPersonsByEmailAsync(String, CancellationToken)
Finds and returns one or more persons, if any, who has the specified email address.
Declaration
public virtual Task<List<TPerson>> FindPersonsByEmailAsync(string email, CancellationToken cancellationToken = default(CancellationToken))
Parameters
String
email
The email address to search for. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<List<TPerson>>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing the persons matching the specified |
Implements
SaveChangesAsync(CancellationToken)
Saves the current store.
Declaration
protected virtual Task SaveChangesAsync(CancellationToken cancellationToken)
Parameters
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task
The System.Threading.Tasks.Task that represents the asynchronous operation. |
SaveEvents(IEventSourced, CancellationToken)
Declaration
public virtual async Task<IdentityResult> SaveEvents(IEventSourced person, CancellationToken cancellationToken = default(CancellationToken))
Parameters
IEventSourced
person
|
System.Threading.CancellationToken
cancellationToken
|
Returns
System.Threading.Tasks.Task<IdentityResult>
|
ThrowIfDisposed()
Throws an System.ObjectDisposedException if the person store is disposed.
Declaration
protected void ThrowIfDisposed()
UpdateAsync(TPerson, CancellationToken)
Updates the specified person
in the person store.
Declaration
public virtual async Task<IdentityResult> UpdateAsync(TPerson person, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TPerson
person
The person to update. |
System.Threading.CancellationToken
cancellationToken
The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled. |
Returns
System.Threading.Tasks.Task<IdentityResult>
The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult of the update operation. |
Implements
Explicit Interface Implementations
IUseExecutionStrategy.Strategy
Declaration
IExecutionStrategy IUseExecutionStrategy.Strategy { get; }
Returns
IExecutionStrategy
|