public ExtensionLogicBase(ExtensionSettingsBase settings)
        {
            Contract.Requires(settings != null);

            this.Settings = settings;
            this.Settings.Validate();

            this.DisplayName = $"{ settings.Description.Id } ({ settings.Description.InstanceId })";
        }
Beispiel #2
0
        public TExtensionLogic BuildLogic <TExtensionLogic>(ExtensionSettingsBase settings, params object[] args) where TExtensionLogic : ExtensionLogicBase
        {
            Type logicType;

            object[] argsExtended;

            argsExtended = args.Concat(new object[] { settings }).ToArray();
            logicType    = settings.GetType().GetFirstAttribute <ExtensionContextAttribute>()?.LogicType;

            if (logicType == null)
            {
                throw new Exception(ErrorMessage.ExtensionFactory_NoMatchingTExtensionLogicFound);
            }

            return((TExtensionLogic)ActivatorUtilities.CreateInstance(_serviceProvider, logicType, argsExtended));
        }