Exemplo n.º 1
0
        public IocContainer Instance <T>(T obj)
        {
            string key = typeof(T).Name;

            _cache[key] = new IocCacheData(true)
            {
                TargetType = typeof(T),
                Key        = key,
                Instance   = obj
            };
            return(this);
        }
Exemplo n.º 2
0
        private void Register <T>(string key, bool singleton)
        {
            Type targetType = typeof(T);

            if (string.IsNullOrEmpty(key))
            {
                key = GetDefaultName(targetType);
            }
            _cache[key] = new IocCacheData(singleton)
            {
                TargetType = targetType,
                Key        = key
            };
        }