Show / Hide Table of Contents

Class PersonManager<TPerson>

Provides the APIs for managing persons in a persistence store.

Inheritance
Object
PersonManager<TPerson>
Inherited Members
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: IRM.AspNetCore.Identity
Assembly: IRM.AspNetCore.Identity.dll
Syntax
public class PersonManager<TPerson> : IDisposable where TPerson : class, IPerson
Type Parameters
TPerson

The type encapsulating a person.

Constructors

PersonManager(IPersonStore<TPerson>, IOptions<ExtendedIdentityOptions>, IEnumerable<IPersonValidator<TPerson>>, IServiceProvider, ILogger<PersonManager<TPerson>>)

Constructs a new instance of PersonManager<TPerson>.

Declaration
public PersonManager(IPersonStore<TPerson> store, IOptions<ExtendedIdentityOptions> optionsAccessor, IEnumerable<IPersonValidator<TPerson>> personValidators, IServiceProvider services, ILogger<PersonManager<TPerson>> logger)
Parameters
IPersonStore<TPerson> store

The persistence store the manager will operate over.

Microsoft.Extensions.Options.IOptions<ExtendedIdentityOptions> optionsAccessor

The accessor used to access the ExtendedIdentityOptions.

IEnumerable<IPersonValidator<TPerson>> personValidators

A collection of IPersonValidator<TPerson> to validate persons against.

System.IServiceProvider services

The System.IServiceProvider used to resolve services.

Microsoft.Extensions.Logging.ILogger<PersonManager<TPerson>> logger

The logger used to log messages, warnings and errors.

Properties

CancellationToken

The cancellation token used to cancel operations.

Declaration
protected virtual CancellationToken CancellationToken { get; }
Property Value
System.Threading.CancellationToken

Logger

The Microsoft.Extensions.Logging.ILogger used to log messages from the manager.

Declaration
public virtual ILogger Logger { get; set; }
Property Value
Microsoft.Extensions.Logging.ILogger

The Microsoft.Extensions.Logging.ILogger used to log messages from the manager.

Options

The ExtendedIdentityOptions used to configure Identity.

Declaration
public ExtendedIdentityOptions Options { get; set; }
Property Value
ExtendedIdentityOptions

PersonValidators

The IPersonValidator<TPerson> used to validate persons.

Declaration
public IList<IPersonValidator<TPerson>> PersonValidators { get; }
Property Value
System.Collections.Generic.IList<IPersonValidator<TPerson>>

Store

Gets the persistence store the manager operates over.

Declaration
protected IPersonStore<TPerson> Store { get; }
Property Value
IPersonStore<TPerson>

The persistence store the manager operates over.

Methods

CreateAsync(TPerson)

Creates the specified person in the person store.

Declaration
public virtual async Task<IdentityResult> CreateAsync(TPerson person)
Parameters
TPerson person

The person to create.

Returns
System.Threading.Tasks.Task<IdentityResult>

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult of the creation operation.

CreateTransactionWrapper()

Creates a transaction wrapper that can handle the EF execution strategies for this managers store.

Declaration
public virtual IResilientTransaction CreateTransactionWrapper()
Returns
IResilientTransaction

A IResilientTransaction that executes an operation in a transaction.

DeleteAsync(TPerson)

Deletes the specified person from the person store.

Declaration
public virtual Task<IdentityResult> DeleteAsync(TPerson person)
Parameters
TPerson person

The person to delete.

Returns
System.Threading.Tasks.Task<IdentityResult>

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult of the deletion operation.

Dispose()

Releases all resources used by the organisation manager.

Declaration
public void Dispose()
Implements
System.IDisposable.Dispose()

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)

Gets the person, if any, associated with the value of the specified email address.

Declaration
public virtual async Task<TPerson> FindByEmailAsync(string email)
Parameters
String email

The email address to return the person for.

Returns
System.Threading.Tasks.Task<TPerson>

The task object containing the results of the asynchronous lookup operation, the person, if any, associated with a value of the specified email address.

FindByIdAsync(Guid)

Finds and returns a person, if any, who has the specified personId.

Declaration
public virtual Task<TPerson> FindByIdAsync(Guid personId)
Parameters
System.Guid personId

The person ID to search for.

Returns
System.Threading.Tasks.Task<TPerson>

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the person matching the specified personId if it exists.

RaiseEvent(TPerson, PersonEvent[])

Adds an PersonEvent to the organisation with common properties set.

Declaration
protected virtual void RaiseEvent(TPerson person, params PersonEvent[] events)
Parameters
TPerson person

The person to add the event to.

PersonEvent[] events

Collection of one or more PersonEvent to add.

ThrowIfDisposed()

Throws an System.ObjectDisposedException if the person manager is disposed.

Declaration
protected void ThrowIfDisposed()

UpdateAsync(TPerson)

Updates the specified person in the person store.

Declaration
public virtual async Task<IdentityResult> UpdateAsync(TPerson person)
Parameters
TPerson person

The person to update.

Returns
System.Threading.Tasks.Task<IdentityResult>

The System.Threading.Tasks.Task that represents the asynchronous operation, containing the IdentityResult of the update operation.

ValidatePersonAsync(TPerson)

Should return Microsoft.AspNetCore.Identity.IdentityResult.Success if validation is successful. This is called before saving the user via Create or Update.

Declaration
protected async Task<IdentityResult> ValidatePersonAsync(TPerson person)
Parameters
TPerson person

The person

Returns
System.Threading.Tasks.Task<IdentityResult>

A IdentityResult representing whether validation was successful.

Back to top Generated by DocFX