Table of Contents

Class DontInjectAttribute

Namespace
Fluxer.Net.Commands
Assembly
Fluxer.Net.dll

Prevents the marked property from being injected into a module.

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

Examples

In the following example, DatabaseService will not be automatically injected into the module and will not throw an error message if the dependency fails to be resolved.

public class MyModule : ModuleBase
{
    [DontInject]
    public DatabaseService DatabaseService;
    public MyModule()
    {
        DatabaseService = DatabaseFactory.Generate();
    }
}

Remarks

This attribute prevents the marked member from being injected into its parent module. Useful when you have a public property that you do not wish to invoke the library's dependency injection service.