Class RequiredReferenceAttribute
Marks a field as a required reference and declares what happens at runtime when it is left empty, so
Inspector tooling can surface an appropriately alarming status instead of staying silent.
Pure metadata with no Unity dependency; it has no effect at runtime — the annotated field keeps its
ordinary behavior.
Deliberately restricted to fields (unlike its sibling reference attributes) because it describes
serialized Inspector fields, which are never properties or parameters.
Implements
Inherited Members
Namespace: Serenity.Global.Application.Attributes
Assembly: Serenity.Global.Application.dll
Syntax
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public sealed class RequiredReferenceAttribute : Attribute, _Attribute
Constructors
RequiredReferenceAttribute(RequirementSeverity)
Creates the attribute with the given severity and no subsystem description.
Declaration
public RequiredReferenceAttribute(RequirementSeverity severity)
Parameters
| Type | Name | Description |
|---|---|---|
| RequirementSeverity | severity | How critical the field is. |
RequiredReferenceAttribute(RequirementSeverity, string)
Creates the attribute with the given severity and subsystem description.
Declaration
public RequiredReferenceAttribute(RequirementSeverity severity, string subsystemDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| RequirementSeverity | severity | How critical the field is. |
| string | subsystemDescription | What stops working when the field is left null. |
Properties
Severity
How critical the field is: throws at boot, disables a subsystem, or purely optional.
Declaration
public RequirementSeverity Severity { get; }
Property Value
| Type | Description |
|---|---|
| RequirementSeverity |
SubsystemDescription
What stops working when the field is left null, shown to explain a RequiredSubsystemDisabled status. May be null or empty for RequiredThrowsAtBoot and Optional cases, where it is not needed.
Declaration
public string SubsystemDescription { get; }
Property Value
| Type | Description |
|---|---|
| string |