-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add AbstractServiceCollection to make it replacable
- Loading branch information
1 parent
f77685e
commit ead6608
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { InjectionToken } from "./InjectionToken"; | ||
import { ClassType, ImplementationFactory, Type, TypeOf } from "./Types"; | ||
import { ServiceLifetime } from "./ServiceLifetime"; | ||
import { ServiceDescriptor } from "./ServiceDescriptor"; | ||
import { Context } from "./Context"; | ||
|
||
export abstract class AbstractServiceCollection { | ||
|
||
abstract HasService(serviceType: Type<any>): boolean; | ||
abstract Remove(serviceType: Type<any>): void; | ||
abstract AddService<T extends Type<any>>(serviceType: T, implementationFactory: ImplementationFactory<TypeOf<T>>, lifetime: ServiceLifetime): void; | ||
abstract AddService<T extends Type<any>>(serviceType: T, implementation: ClassType<TypeOf<T>>, lifetime: ServiceLifetime): void; | ||
abstract TryAddService<T>(serviceType: Type<T>, implementation: ClassType<T> | ImplementationFactory<T>, lifetime: ServiceLifetime): void; | ||
abstract AppendService<T>(serviceType: Type<T>, implementation: ClassType<T> | ImplementationFactory<T>, lifetime: ServiceLifetime): void; | ||
abstract ReplaceService<T>(serviceType: Type<T>, implementation: ClassType<T> | ImplementationFactory<T>, lifetime: ServiceLifetime): void; | ||
|
||
abstract AddContext(context: Context): void; | ||
abstract DeleteContext(context: Context): void; | ||
abstract HasContext(context: Context): boolean; | ||
|
||
abstract getServiceDescriptors<T>(serviceType: Type<T>): ServiceDescriptor[]; | ||
|
||
} | ||
|
||
export type LocateOptions = { serviceType: Type<any>, multiple: boolean, context?: Context }; |