예제 #1
0
        public void Register(Type dependency, Type implementationType, Lifetime lifetime = Lifetime.Transient, ServiceImplementations implementation = ServiceImplementations.None)
        {
            var newImplInfo = new ImplementationInfo(implementationType, lifetime, implementation);

            if (!dependencies.ContainsKey(dependency))
            {
                dependencies.Add(dependency, new List <ImplementationInfo>());
            }

            dependencies[dependency].Add(newImplInfo);
        }
예제 #2
0
        public void Register <TDependency, TImplementation>(Lifetime lifetime = Lifetime.Transient, ServiceImplementations implementation = ServiceImplementations.None)
            where TDependency : class
            where TImplementation : TDependency
        {
            var newImplInfo = new ImplementationInfo(typeof(TImplementation), lifetime, implementation);

            if (!dependencies.ContainsKey(typeof(TDependency)))
            {
                dependencies.Add(typeof(TDependency), new List <ImplementationInfo>());
            }

            dependencies[typeof(TDependency)].Add(newImplInfo);
        }