Table of Contents

Class DontInjectAttribute

Namespace
Discord.Commands
Assembly
Discord.Net.Commands.dll

Prevents the marked property from being injected into a module.

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class DontInjectAttribute : Attribute
Inheritance
DontInjectAttribute
Inherited Members

Examples

public class MyModule : ModuleBase<SocketCommandContext>
{
    [DontInject]
    public MyService MyService { get; set; }

    public MyModule()
    {
        MyService = new MyService();
    }
}

Remarks

The attribute can be applied to a public settable property inside a ModuleBase based class. By applying this attribute, the marked property will not be automatically injected of the dependency. See @Guides.Commands.DI to learn more.