Class MainDom
Provides the full implementation of IMainDom.
Inheritance
Namespace: Umbraco.Core.Runtime
Assembly: Umbraco.Core.dll
Syntax
public class MainDom : IMainDom, IRegisteredObject, IDisposable
Remarks
When an AppDomain starts, it tries to acquire the main domain status.
When an AppDomain stops (eg the application is restarting) it should release the main domain status.
Constructors
View SourceMainDom(ILogger, IMainDomLock)
Declaration
public MainDom(ILogger logger, IMainDomLock systemLock)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | |
IMainDomLock | systemLock |
Properties
View SourceIsMainDom
Gets a value indicating whether the current domain is the main domain.
Declaration
public bool IsMainDom { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The lazy initializer call will only call the Acquire callback when it's not been initialized, else it will just return the value from _isMainDom which means when we set _isMainDom to false again after being signaled, this will return false;
Methods
View SourceDispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
GetMainDomId()
Declaration
public static string GetMainDomId()
Returns
Type | Description |
---|---|
System.String |
Register(Action, Action, Int32)
Registers a resource that requires the current AppDomain to be the main domain to function.
Declaration
public bool Register(Action install, Action release, int weight = 100)
Parameters
Type | Name | Description |
---|---|---|
System.Action | install | An action to execute when registering. |
System.Action | release | An action to execute before the AppDomain releases the main domain status. |
System.Int32 | weight | An optional weight (lower goes first). |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether it was possible to register. |
Remarks
If registering is successful, then the install
action
is guaranteed to execute before the AppDomain releases the main domain status.
Register(Action, Int32)
Registers a resource that requires the current AppDomain to be the main domain to function.
Declaration
public bool Register(Action release, int weight = 100)
Parameters
Type | Name | Description |
---|---|---|
System.Action | release | An action to execute before the AppDomain releases the main domain status. |
System.Int32 | weight | An optional weight (lower goes first). |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether it was possible to register. |