ServiceHelper

ServiceHelper

Helper utilities for service resolution with enhanced error handling. This class provides convenient methods for resolving services from the nearest IServiceCompositionRoot with better error handling and diagnostics.

Project: GridPlacement v6.0
Layer: Godot
Source: Godot/Core/_incomplete/Services/DI/ServiceHelper.cs
Namespace: GridBuilding.Core.Services.DI
Kind: class

Parsing Method: AST-based (Roslyn) - NOT regex

⚠️ IMPORTANT: This documentation was generated using AST parsing, not regex.

Methods

GetRequiredService

Gets a required service from the nearest IServiceCompositionRoot. Throws if the service is not available.

Returns: T

Parameters:

  • IServiceContext context

GetOptionalService

Gets an optional service from the nearest IServiceCompositionRoot. Returns null if the service is not available.

Returns: T?

Parameters:

  • IServiceContext context

TryGetService

Attempts to get a service with detailed error information.

Returns: bool

Parameters:

  • IServiceContext context
  • T? service
  • ServiceResolutionError? error

GetAvailableServices

Gets all available services from the nearest IServiceCompositionRoot.

Returns: System.Collections.Generic.Dictionary<Type, bool>

Parameters:

  • IServiceContext context

ValidateServices

Validates service availability for a node.

Returns: ServiceValidationResult

Parameters:

  • IServiceContext context
  • Type[] requiredServices