Beispiel #1
0
        public object Resolve(Identifier id)
        {
            IDependency dependency = _dependencyTree.FindDependencyAggressive(id);

            if (dependency != null && dependency.CanBeResolved())
            {
                return(dependency.Resolve());
            }

            foreach (ISignedContract subContract in _subContracts)
            {
                if (subContract.CanResolve(id))
                {
                    return(subContract.Resolve(id));
                }
            }

            throw new ResolveException($"Dependency with id {id} does not exist");
        }
Beispiel #2
0
        public object Resolve(Type type, Identifier id = default)
        {
            IDependency dependency = _dependencyTree.FindDependency(type, id);

            if (dependency != null && dependency.CanBeResolved())
            {
                return(dependency.Resolve());
            }

            foreach (ISignedContract subContract in _subContracts)
            {
                if (subContract.CanResolve(type, id))
                {
                    return(subContract.Resolve(type, id));
                }
            }

            throw new ResolveException($"Dependency with type {type.Name} ({id}) does not exist");
        }