Example #1
0
        /// <summary>
        /// The register type.
        /// </summary>
        /// <param name="typeToRegister">
        /// The type to register.
        /// </param>
        private void RegisterPlugin(Type typeToRegister)
        {
            var interfaceName = $"I{typeToRegister.Name}";
            var mainInterface = typeToRegister.GetInterface(interfaceName);

            if (mainInterface == null)
            {
                PluginLogger.LogWarning("Registering type [{0}] with no matching interface", typeToRegister.Name);

                container.RegisterType(
                    typeToRegister,
                    new InjectionProperty("StfContainer"),
                    new InjectionProperty("StfLogger"));

                return;
            }

            PluginLogger.LogInfo("Registering type [{0}] with matching interface [{1}]", typeToRegister.Name, interfaceName);

            container.RegisterMyType(mainInterface, typeToRegister);
        }