.NET AppDomains
Services implemented in .NET have full access to .NET’s AppDomain functionality. You can manage multiple persistent AppDomains across Service invocations while still having access to the entire DataSynapse Engine-side API. You can specify an AppDomain as part of a Grid Library deployment, and the Engine sets up and manages it automatically.
The Provider section in the Service Type Registry for .NET Services supports an appDomainName value. Set the appDomainName value to specify a unique AppDomain for Services created from this Service Type. If you do not specify an AppDomain for a Service, the Service receives a new anonymous AppDomain with a randomized name. The Service does not run in the Default Domain as it did in previous versions of GridServer. If you create a Service that uses legacy Default Resources rather than a Grid Library, the Service runs in an auxiliary AppDomain. All resources-backed Services use this same auxiliary AppDomain for the lifetime of the Engine.
When you specify an AppDomain as part of a Service Type definition and an Engine creates the Service for the first time, the Assembly search paths used for the AppDomain depend on how you deploy resources:
| • | When a Service uses a Grid Library, the assembly-path path elements for that Grid Library (and any dependent Grid Libraries) are the Assembly search paths for the AppDomain. |
| • | When a Service does not use a Grid Library, the default Assembly search path is used. |
The Engine searches the Assembly search path for a valid AppDomain Configuration File, which has the same name as the AppDomain, plus the .config suffix.
An Engine restarts if it needs to load a Grid Library to run a Service in an AppDomain that has an Assembly search path that conflicts with the new Grid Library’s search path. This is different behavior from previous versions of GridServer.
Use the unloadAppDomain property in the Service Type to specify what to do with Grid Library-backed AppDomains after the Service Sessions using them are destroyed. Select true to unload AppDomains no longer in use.