Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { MetaConfigService } from "@server/meta/fd-meta-core/meta-config/meta-config-service";
- import { singleOrDefault } from "@server/fd/fd-toolbox/collections/single-warnings";
- import { FdLifetimeScope } from "@server/fd/fd-toolbox/di/fd-lifetime-scope";
- let metaConfigServices: MetaConfigService[] | null = null;
- export function getMetaConfigService(resourceName: string): MetaConfigService | undefined {
- const services = getMetaConfigServices();
- return singleOrDefault(services.filter(h => h.ResourceName === resourceName));
- }
- function getMetaConfigServices(): MetaConfigService[] {
- if (!metaConfigServices) {
- const lifetimeScope = new FdLifetimeScope();
- metaConfigServices = lifetimeScope.resolve<MetaConfigService[]>("MetaConfigServices");
- if (!Array.isArray(metaConfigServices)) {
- throw new Error("Failed to resolve MetaConfigServices");
- }
- }
- return metaConfigServices;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement