-
Notifications
You must be signed in to change notification settings - Fork 6
Processes and Domains
Cy Scott edited this page Apr 21, 2019
·
4 revisions
AppDomainAlternative wraps processes with an abstract Domain class which facilitates remoting class instances between processes similar to AppDomains. The Domain class has the following properties:
-
Channels- This property is a collection channels used for managing remoting instances between domains/processes. A channel is a duplexed communication stream used to communicate remoting information across the process barrier. This property may be null if the domain has no parent.-
AsObservable- Is an observable stream of channels used for remoting. This observable stream can be used to process code when new channels are created as they are created. -
CreateInstance- Opens a channel for remoting an instance with another domain. This method can be used to replicate the AppDomain features provided by theCreateInstance,CreateInstanceAndUnwrap,CreateInstanceFrom, andCreateInstanceFromAndUnwrapmethods. -
GetInstanceOf<T>- This async method gets either an existing or the next created remoting instance of a typeT. -
NewChannel- Is an event that is invoked when new channels are created for remoting an instance.
-
-
Process- This property represents the process the domain instance wraps.
The CurrentDomain instance is a Domain wrapper for the current process. The current domain instance can be accessed via the static property Domains.Current which is equivalent to AppDomain.CurrentDomain for AppDomains. The CurrentDomain class has the following properties:
-
this[int id]- Gets a child domain/process by process id. -
AddChildDomain- Creates a child domain/process. -
Count- The number of living child domains/processes. -
TryToGetChild- Tries to get a child domain/process by process id.
The ChildDomain is a Domain wrapper for a child process created by the current domain. You can create a child process by using the AddChildDomain method like: var childDomain = Domains.Current.AddChildDomain(new ProcessStartInfo("dotnet", "path to .Net Core assembly"));