Class SingleObjectResolverBase<TResolver, TResolved>
The base class for all single-object resolvers.
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public abstract class SingleObjectResolverBase<TResolver, TResolved> : ResolverBase<TResolver> where TResolver : ResolverBase where TResolved : class
Type Parameters
Name | Description |
---|---|
TResolver | The type of the concrete resolver class. |
TResolved | The type of the resolved object. |
Remarks
Resolves "single" objects ie objects for which there is only one application-wide instance, such as the MVC Controller factory.
Constructors
SingleObjectResolverBase()
Initialize a new instance of the SingleObjectResolverBase<TResolver, TResolved> class.
Declaration
protected SingleObjectResolverBase()
Remarks
By default CanBeNull
is false, so Value
has to be initialized before being read,
otherwise an exception will be thrown when reading it.
SingleObjectResolverBase(TResolved)
Initialize a new instance of the SingleObjectResolverBase<TResolver, TResolved> class with an instance of the resolved object.
Declaration
protected SingleObjectResolverBase(TResolved value)
Parameters
Type | Name | Description |
---|---|---|
TResolved | value | An instance of the resolved object. |
Remarks
By default CanBeNull
is false, so value
has to be non-null, or Value
has to be
initialized before being accessed, otherwise an exception will be thrown when reading it.
SingleObjectResolverBase(TResolved, Boolean)
Initialize a new instance of the SingleObjectResolverBase<TResolver, TResolved> class with an instance of the resolved object, and a value indicating whether that instance can be null.
Declaration
protected SingleObjectResolverBase(TResolved value, bool canBeNull)
Parameters
Type | Name | Description |
---|---|---|
TResolved | value | An instance of the resolved object. |
System.Boolean | canBeNull | A value indicating whether the resolved object instance can be null. |
Remarks
If CanBeNull
is false, value
has to be non-null, or Value
has to be initialized before being read,
otherwise an exception will be thrown when reading it.
SingleObjectResolverBase(Boolean)
Initialize a new instance of the SingleObjectResolverBase<TResolver, TResolved> class with a value indicating whether the resolved object instance can be null.
Declaration
protected SingleObjectResolverBase(bool canBeNull)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | canBeNull | A value indicating whether the resolved object instance can be null. |
Remarks
If CanBeNull
is false, Value
has to be initialized before being read,
otherwise an exception will be thrown when reading it.
Properties
CanBeNull
Gets a value indicating whether the resolved object instance can be null.
Declaration
public bool CanBeNull { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
HasValue
Gets a value indicating whether the resolved object instance is null.
Declaration
public bool HasValue { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Value
Gets or sets the resolved object instance.
Declaration
protected TResolved Value { get; set; }
Property Value
Type | Description |
---|---|
TResolved |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | value is set to null, but cannot be null ( |
System.InvalidOperationException | value is read and is null, but cannot be null ( |