Domain driven development with hidden depency ‘injection’ / control via a single static class
class Domain { private static portResolver: IPortResolver; public static setPortResolver(portResolver : IPortResolver) { Domain.portResolver = portResolver; } static get RequestUserSession() : IRequestUserSession { return Domain.portResolver.resolve<IRequestUserSession>("IRequestUserSession"); } } const portResolver = new PortResolver(); portResolver.registerInstance<IRequestUserSession>("IRequestUserSession", () => new UserSessionService()); Domain.setPortResolver(portResolver); Domain.RequestUserSession.requestUserSession(null, null, null);
183400cookie-checkStatic Domain class