Ejemplo n.º 1
0
        public object GetInstance(string name, params object[] pars)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = NONE_NAME;
            }
            if (_dicName2Obj.ContainsKey(name))
            {
                object o = _dicName2Obj[name];
                if (o is Type type)
                {
                    object k = reflection.GetInstance(type, pars);
                    if (_allSingle ||
                        (_dicName2Single.ContainsKey(name) && _dicName2Single[name]))
                    {
                        _dicName2Obj[name] = k;
                    }
                    return(k);
                }

                return(_dicName2Obj[name]);
            }

            //返回null
            return(default);