コード例 #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);
        }
コード例 #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
            };
        }