Show / Hide Table of Contents

Class OrganisationStore<TOrganisation, TContext>

Represents a new instance of a persistence store for the specified organisation type.

Inheritance
Object
OrganisationStore<TOrganisation, TContext>
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.EntityFrameworkCore
Assembly: IRM.AspNetCore.Identity.EntityFrameworkCore.dll
Syntax
public class OrganisationStore<TOrganisation, TContext> : IOrganisationStore<TOrganisation>, IDisposable, IUseExecutionStrategy where TOrganisation : class, IOrganisation, new()
    where TContext : DbContext
Type Parameters
TOrganisation

The type representing an organisation.

TContext

The type of the data context class used to access the store.

Constructors

OrganisationStore(TContext, ILogger<OrganisationStore<TOrganisation, TContext>>, IAsyncEventSourceRepository, IdentityErrorDescriber)

Creates a new instance of OrganisationStore<TOrganisation, TContext>.

Declaration
public OrganisationStore(TContext context, ILogger<OrganisationStore<TOrganisation, TContext>> logger, IAsyncEventSourceRepository eventSourceRepository = null, IdentityErrorDescriber describer = null)
Parameters
TContext context

The context used to access the store.

Microsoft.Extensions.Logging.ILogger<OrganisationStore<TOrganisation, 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

AddSearchTerms(IQueryable<TOrganisation>, OrganisationSearchQuery)

Adds all search terms when searching for organisations.

Declaration
protected IQueryable<TOrganisation> AddSearchTerms(IQueryable<TOrganisation> linqQuery, OrganisationSearchQuery query)
Parameters
System.Linq.IQueryable<TOrganisation> linqQuery

The LINQ query constructed so far.

OrganisationSearchQuery query

The query describing filtering and sorting for the organisations.

Returns
System.Linq.IQueryable<TOrganisation>

The LINQ query with the search terms added.

CreateAsync(TOrganisation, CancellationToken)

Creates the specified organisation in the organisation store.

Declaration
public async Task<IdentityResult> CreateAsync(TOrganisation organisation, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TOrganisation organisation

The organisation 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
IOrganisationStore<TOrganisation>.CreateAsync(TOrganisation, CancellationToken)

DeleteAsync(TOrganisation, CancellationToken)

Deletes an organisation from the store as an asynchronous operation.

Declaration
public async Task<IdentityResult> DeleteAsync(TOrganisation organisation, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TOrganisation organisation

The organisation to delete from the store.

System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.

Returns
System.Threading.Tasks.Task<IdentityResult>

A System.Threading.Tasks.Task<TResult> that represents the IdentityResult of the asynchronous query.

Implements
IOrganisationStore<TOrganisation>.DeleteAsync(TOrganisation, CancellationToken)

Dispose()

Releases all resources used by the store.

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.

FindByIdsAsync(Guid[], CancellationToken)

Finds and returns a list of organisations, if any, who has any of the specified organisationIds.

Declaration
public virtual async Task<List<TOrganisation>> FindByIdsAsync(Guid[] organisationIds, CancellationToken cancellationToken = default(CancellationToken))
Parameters
System.Guid[] organisationIds

The organisation 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<List<TOrganisation>>

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

Implements
IOrganisationStore<TOrganisation>.FindByIdsAsync(Guid[], CancellationToken)

FindByNameAsync(String, Nullable<Guid>, CancellationToken)

Gets the organisation, if any, associated with the specified name.

Declaration
public virtual Task<TOrganisation> FindByNameAsync(string organisationName, Guid? groupMotherId = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
String organisationName

The organisation name to search for.

System.Nullable<System.Guid> groupMotherId

Specifies optional organisation to search within

System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.

Returns
System.Threading.Tasks.Task<TOrganisation>

The task object containing the results of the asynchronous lookup operation, the organisation if any associated with the specified organisation name.

Implements
IOrganisationStore<TOrganisation>.FindByNameAsync(String, Nullable<Guid>, CancellationToken)

FindByTrustedDomainAsync(String, CancellationToken)

Gets the organisation keys, if any, associated with the specified domain name.

Declaration
public virtual Task<OrganisationKeys> FindByTrustedDomainAsync(string normalizedDomainName, CancellationToken cancellationToken = default(CancellationToken))
Parameters
String normalizedDomainName

The organisation name 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<OrganisationKeys>

The task object containing the results of the asynchronous lookup operation, the organisation keys if any associated with the specified organisation name.

Implements
IOrganisationStore<TOrganisation>.FindByTrustedDomainAsync(String, CancellationToken)

GetAllAsync(OrganisationSearchQuery, CancellationToken)

Gets all organisations matching the query.

Declaration
public virtual Task<QueryResult<TOrganisation>> GetAllAsync(OrganisationSearchQuery query, CancellationToken cancellationToken = default(CancellationToken))
Parameters
OrganisationSearchQuery query

The query describing filtering and sorting for the organisations.

System.Threading.CancellationToken cancellationToken

The System.Threading.CancellationToken used to propagate notifications that the operation should be canceled.

Returns
System.Threading.Tasks.Task<QueryResult<TOrganisation>>

A System.Threading.Tasks.Task that represents the QueryResult<T> of the asynchronous query.

Implements
IOrganisationStore<TOrganisation>.GetAllAsync(OrganisationSearchQuery, CancellationToken)

GetAllTrustedDomainsAsync(CancellationToken)

Gets a list of all trusted domain that have been registered.

Declaration
public virtual Task<List<TrustedDomainMatch>> GetAllTrustedDomainsAsync(CancellationToken cancellationToken = default(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<List<TrustedDomainMatch>>

The task object containing the results of the asynchronous operation, the list of all trusted domains.

Implements
IOrganisationStore<TOrganisation>.GetAllTrustedDomainsAsync(CancellationToken)

GetOrganisation(Expression<Func<TOrganisation, Boolean>>, CancellationToken)

Gets an organisation with default includes for this store implementation.

Declaration
protected virtual async Task<TOrganisation> GetOrganisation(Expression<Func<TOrganisation, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Expression<System.Func<TOrganisation, Boolean>> predicate

A function to test each element for a condition.

System.Threading.CancellationToken cancellationToken

A System.Threading.CancellationToken to observe while waiting for the task to complete.

Returns
System.Threading.Tasks.Task<TOrganisation>

LoadSubsidiaries(IOrganisation, CancellationToken)

Loads all subsidiaries for the organisaiton.

Declaration
protected Task LoadSubsidiaries(IOrganisation organisation, CancellationToken cancellationToken)
Parameters
IOrganisation organisation

The organisation to load subsidiaries for,

System.Threading.CancellationToken cancellationToken

A System.Threading.CancellationToken to observe while waiting for the task to complete.

Returns
System.Threading.Tasks.Task

The System.Threading.Tasks.Task that represents the asynchronous operation.

Remarks

This will not work for non-tracked organisations.

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 organisation, CancellationToken cancellationToken = default(CancellationToken))
Parameters
IEventSourced organisation

System.Threading.CancellationToken cancellationToken

Returns
System.Threading.Tasks.Task<IdentityResult>

ThrowIfDisposed()

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

Declaration
protected void ThrowIfDisposed()

UpdateAsync(TOrganisation, CancellationToken)

Updates a organisation in a store as an asynchronous operation.

Declaration
public async Task<IdentityResult> UpdateAsync(TOrganisation organisation, CancellationToken cancellationToken = default(CancellationToken))
Parameters
TOrganisation organisation

The organisation to update in the store.

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 for the update.

Implements
IOrganisationStore<TOrganisation>.UpdateAsync(TOrganisation, CancellationToken)

Explicit Interface Implementations

IUseExecutionStrategy.Strategy

Declaration
IExecutionStrategy IUseExecutionStrategy.Strategy { get; }
Returns
IExecutionStrategy

Implements
IUseExecutionStrategy.Strategy

IUseExecutionStrategy.Suspended

Declaration
bool IUseExecutionStrategy.Suspended { get; set; }
Returns
Boolean

Implements
IUseExecutionStrategy.Suspended
Back to top Generated by DocFX