コード例 #1
0
ファイル: InjectorContext.cs プロジェクト: Aosamesan/injector
            public InjectorContextBuilder Add(string name, object obj)
            {
                AttributeHelper.CheckCorrectCall <ContextConfiguableMethod>();
                var type = obj.GetType();

                nameDictionary[name] = obj;
                if (!anonymousObjectTypeSet.Contains(type))
                {
                    typeDictionary[type] = obj;
                }

                return(this);
            }
コード例 #2
0
ファイル: InjectorContext.cs プロジェクト: Aosamesan/injector
            public InjectorContextBuilder Add(object obj)
            {
                AttributeHelper.CheckCorrectCall <ContextConfiguableMethod>();
                var type = obj.GetType();

                if (anonymousObjectTypeSet.Contains(type))
                {
                    throw new DuplicatedObjectException(type);
                }

                typeDictionary[type] = obj;
                anonymousObjectTypeSet.Add(type);

                return(this);
            }