miniSql

创建
zgc123@gmail.com authored at 11/19/2023 1:40:15 AM
6136600
Tree
0 Parent(s)
Summary: 1 changed files with 96 additions and 0 deletions.
Added +96 -0
Added +96 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery.Core/PluginLoaderBase.cs b/minisqlquery-master/src/MiniSqlQuery.Core/PluginLoaderBase.cs
new file mode 100644
index 0000000..79edeca
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery.Core/PluginLoaderBase.cs
@@ -0,0 +1,96 @@
+#region License
+
+// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
+// This source code is made available under the terms of the GNU Lesser General Public License v3.0
+// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
+
+#endregion
+
+
+namespace MiniSqlQuery.Core
+{
+    /// <summary>
+    /// 	A simple base class to use for implementing the <see cref = "IPlugIn" /> interface.
+    /// </summary>
+    public abstract class PluginLoaderBase : IPlugIn
+    {
+        /// <summary>
+        /// 	Initializes a new instance of the <see cref = "PluginLoaderBase" /> class. Creates a new instance of a plugin loader class.
+        /// </summary>
+        /// <param name = "name">The descriptive name of the plugin</param>
+        /// <param name = "description">A brief description of the plugin.</param>
+        /// <remarks>
+        /// 	The <see cref = "RequestedLoadOrder" /> defaults to 1000.
+        /// </remarks>
+        protected PluginLoaderBase(string name, string description)
+            : this(name, description, 1000)
+        {
+        }
+
+        /// <summary>
+        /// 	Initializes a new instance of the <see cref = "PluginLoaderBase" /> class. Creates a new instance of a plugin loader class.
+        /// </summary>
+        /// <param name = "name">The descriptive name of the plugin</param>
+        /// <param name = "description">A brief description of the plugin.</param>
+        /// <param name = "requestedLoadOrder">The requested load order. See <see cref = "IPlugIn.RequestedLoadOrder" />.</param>
+        protected PluginLoaderBase(string name, string description, int requestedLoadOrder)
+        {
+            PluginName = name;
+            PluginDescription = description;
+            RequestedLoadOrder = requestedLoadOrder;
+        }
+
+        /// <summary>
+        /// 	Gets a brief description of the plugin.
+        /// </summary>
+        /// <value>The plugin description.</value>
+        public string PluginDescription { get; private set; }
+
+        /// <summary>
+        /// 	Gets the descriptive name of the plugin.
+        /// </summary>
+        /// <value>The plugin name.</value>
+        public string PluginName { get; private set; }
+
+        /// <summary>
+        /// 	Gets the "order" value for a lame ordering system. 
+        ///		TODO: needs to be replaced with Windsor containter etc.
+        /// </summary>
+        /// <value>The requested load order.</value>
+        public int RequestedLoadOrder { get; private set; }
+
+        /// <summary>
+        /// 	Gets a reference to the applications service manager.
+        /// </summary>
+        /// <value>The services.</value>
+        public IApplicationServices Services { get; private set; }
+
+        /// <summary>
+        /// 	Must be implemented by the inheriting class. 
+        /// 	Called after the application has started.
+        /// </summary>
+        public abstract void InitializePlugIn();
+
+        /// <summary>
+        /// 	Called when the plugins are loading during application startup. 
+        /// 	Stores the reference to <paramref name = "services" />.
+        /// </summary>
+        /// <param name = "services">The application services intance.</param>
+        public void LoadPlugIn(IApplicationServices services)
+        {
+            Services = services;
+        }
+
+        /// <summary>
+        /// 	Called as the application is shutting down.
+        /// </summary>
+        /// <remarks>
+        /// 	In most cases there is probably no need to do anything here, all controls etc created
+        /// 	will be disposed of implicitly. It would only be unmanaged references created explicitly
+        /// 	by the plugin that would need removal or cleanup.
+        /// </remarks>
+        public virtual void UnloadPlugIn()
+        {
+        }
+    }
+}
\ No newline at end of file