Links

InjectAttribute

Wisej.Services.InjectAttribute
Namespace: Wisej.Services
Assembly: Wisej.Framework (3.1.0.0)
Indicates that the associated property references a service injected by the service provider during initialization.
C#
VB.NET
public class InjectAttribute : Attribute
Public Class InjectAttribute
Inherits Attribute
Use this attribute on properties (can be private, protected, or public) that represent an injected service instance.
public class MainView : Page {
[Inject(Required=true)]
protected ILogger Logger {get; set;}
}
Dependency injection is applied automatically for all top level containers: Form, Page, Desktop; and for all service instances created by the system. You can also inject dependencies into other objects by calling Application.Services.Inject after creating the target object.

Constructors

InjectAttribute()

Initializes a new instance of the InjectAttribute class.

InjectAttribute(required)

Initializes a new instance of the InjectAttribute class.
Name
Type
Description
required
Boolean
True to indicated that the service is required.

Properties

Required

Boolean: Indicates that the service is required.