Skip to content

Boundary Provider

  • import: @azure-net/kit
  • Preferred location (for context): src/app/contexts/{ContextName}/application/providers

Example of creating a provider for application layer

typescript
import { createBoundaryProvider } from '@azure-net/kit';
import { InfrastructureProvider } from '${ContextName}/infrastructure';
import { AuthService } from '../services';

export const ApplicationProvider = createBoundaryProvider('{ContextName}ApplicationProvider', {
    // Set dependency on the infrastructure provider to get access to what is registered in it
    dependsOn: { InfrastructureProvider },
    register: ({ InfrastructureProvider }) => ({
        // Give the service a repository from the infrastructure provider
        AuthService: () => new AuthService(InfrastructureProvider.AuthRepository)
    })
});