Table of Contents

Class ScopeServiceCollectionExtensions

Namespace
Tharga.Team.Service
Assembly
Tharga.Team.Service.dll

Extension methods for registering scopes and scope-protected services.

public static class ScopeServiceCollectionExtensions
Inheritance
ScopeServiceCollectionExtensions
Inherited Members

Methods

AddScopedWithScopes<TService, TImplementation>(IServiceCollection, ServiceScopeKind)

Registers a scoped service wrapped in a ScopeProxy<T> that enforces RequireScopeAttribute on every method call. Prefer the intent-revealing AddTeamService<TService, TImplementation>(IServiceCollection) and AddSystemService<TService, TImplementation>(IServiceCollection).

public static IServiceCollection AddScopedWithScopes<TService, TImplementation>(this IServiceCollection services, ServiceScopeKind scopeKind) where TService : class where TImplementation : class, TService

Parameters

services IServiceCollection
scopeKind ServiceScopeKind

Returns

IServiceCollection

Type Parameters

TService
TImplementation

AddSystemService<TService, TImplementation>(IServiceCollection)

Registers a service whose operations act across the whole system rather than on a team. The scope is checked as a system scope and no team need be selected.

public static IServiceCollection AddSystemService<TService, TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService

Parameters

services IServiceCollection

Returns

IServiceCollection

Type Parameters

TService
TImplementation

AddTeamService<TService, TImplementation>(IServiceCollection)

Registers a service whose every operation acts on one team. The scope declared by RequireScopeAttribute is checked against the team named by the call's first argument, so holding the scope for one team does not authorize acting on another.

public static IServiceCollection AddTeamService<TService, TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService

Parameters

services IServiceCollection

Returns

IServiceCollection

Type Parameters

TService
TImplementation

AddThargaScopes(IServiceCollection, Action<ScopeRegistry>)

Registers the scope registry and configures scopes.

public static IServiceCollection AddThargaScopes(this IServiceCollection services, Action<ScopeRegistry> configure)

Parameters

services IServiceCollection
configure Action<ScopeRegistry>

Returns

IServiceCollection

AddThargaSystemRoles(IServiceCollection, Action<SystemRoleRegistry>)

Registers the system-role registry (maps app/global roles to system scopes) and configures it.

public static IServiceCollection AddThargaSystemRoles(this IServiceCollection services, Action<SystemRoleRegistry> configure)

Parameters

services IServiceCollection
configure Action<SystemRoleRegistry>

Returns

IServiceCollection

AddThargaSystemScopes(IServiceCollection, Action<SystemScopeRegistry>)

Registers the system-scope registry (global scopes for system API keys / privileged roles) and configures it.

public static IServiceCollection AddThargaSystemScopes(this IServiceCollection services, Action<SystemScopeRegistry> configure)

Parameters

services IServiceCollection
configure Action<SystemScopeRegistry>

Returns

IServiceCollection