Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 911 Bytes

global-compositions.md

File metadata and controls

26 lines (18 loc) · 911 Bytes

Global compositions

CSharp

When the Setup(name, kind) method is called, the second optional parameter specifies the composition kind. If you set it as CompositionKind.Global, no composition class will be created, but this setup will be the base setup for all others in the current project, and DependsOn(...) is not required. The setups will be applied in the sort order of their names.

class MyGlobalComposition
{
    void Setup() =>
        DI.Setup(nameof(GlobalCompositionsScenario), CompositionKind.Global)
            .Hint(Hint.ToString, "On")
            .Hint(Hint.FormatCode, "Off");
}

class MyGlobalComposition2
{
    void Setup() =>
        DI.Setup(nameof(MyGlobalComposition2), CompositionKind.Global)
            .Hint(Hint.FormatCode, "On");
}