Configure Dependency Scopes
mainDioma provides several scope types to control the lifecycle and instantiation of classes via the static scope property:
Scopes.Singleton(): Creates a single instance for the entire application (stored in the global container).Scopes.Transient(): Creates a new instance on every injection.Scopes.Container(): Creates a single instance per container (also referred to asScopes.Scoped()).Scopes.Resolution(): Creates a new instance every time, but the same instance is reused for the duration of a single resolution (useful for request-scoped data).
import { Scopes } from "dioma";
class MyService {
static scope = Scopes.Singleton(); // or Transient(), Container(), Resolution()
}