Exemplo n.º 1
0
        public static T ProvideManager <T>(string configurationSettings)
            where T : ManagerBase2, new()
        {
            ManagerProviderBaseConfiguration configurationSection =
                ConfigurationManager.GetSection(configurationSettings) as ManagerProviderBaseConfiguration;

            if (configurationSection != null)
            {
                object a;
                CoreService.TryFindType(configurationSection.DerivedType, out a);

                T myObject = a as T;
                if (a == null)
                {
                    managers.WriteWarning("XmlSections", "Section {0} was not found using default manager/factory", configurationSettings);
                    myObject = new T();
                }
                return(myObject);
            }
            else
            {
                managers.WriteWarning("XmlSections", "Section {0} was not found using default manager/factory", configurationSettings);
                T myObject = new T();
                return(myObject);
            }
        }
Exemplo n.º 2
0
        public new static T ProvideManager <T>(string configurationSettings)
            where T : FactoryBase, new()
        {
            ManagerProviderBaseConfiguration configurationSection =
                ConfigurationManager.GetSection(configurationSettings) as ManagerProviderBaseConfiguration;

            if (configurationSection != null)
            {
                object a;
                CoreService.TryFindType(configurationSection.DerivedType, out a);

                T myObject = a as T;
                if (a == null)
                {
                    myObject = new T();
                }
                return(myObject);
            }
            else
            {
                T myObject = new T();
                return(myObject);
            }
        }