コード例 #1
0
        private static object ResolveSingle(IResolutionRoot root, Type service, Func <IBindingMetadata, bool> constraint, IReadOnlyList <IParameter> parameters, bool isOptional, bool isUnique)
        {
            Ensure.ArgumentNotNull(root, nameof(root));

            var request = root.CreateRequest(service, constraint, parameters, isOptional, isUnique);

            return(root.ResolveSingle(request));
        }
コード例 #2
0
        private static T DoTryGetAndThrowOnInvalidBinding <T>(IResolutionRoot root, Func <IBindingMetadata, bool> constraint, IReadOnlyList <IParameter> parameters)
        {
            Ensure.ArgumentNotNull(root, nameof(root));

            var request = root.CreateRequest(typeof(T), constraint, parameters, true, true);

            request.ForceUnique = true;
            return((T)root.ResolveSingle(request));
        }