diff Implab/Components/App.cs @ 192:f1da3afc3521 release v2.1

Слияние с v2
author cin
date Fri, 22 Apr 2016 13:10:34 +0300
parents b933ec88446e
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab/Components/App.cs	Fri Apr 22 13:10:34 2016 +0300
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace Implab.Components {
+    /// <summary>
+    /// Global application components and services.
+    /// </summary>
+    public static class App {
+        readonly static ComponentContainer<object> _root = new ComponentContainer<object>();
+
+        /// <summary>
+        /// The container for application level components.
+        /// </summary>
+        /// <remarks>Pools of disposable objects can be placed here and they will be automatically
+        /// disposed when application domain is unloaded.</remarks>
+        public static ICollection<object> RootContainer {
+            get { return _root; }
+        }
+
+        static App() {
+            AppDomain.CurrentDomain.DomainUnload += (sender, e) => _root.Dispose();
+        }
+    }
+}
+