コード例 #1
0
        public Task<IBinding> TryCreateAsync(BindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ParameterInfo parameter = context.Parameter;
            if (parameter.ParameterType != typeof(TraceWriter) &&
                parameter.ParameterType != typeof(TextWriter))
            {
                return Task.FromResult<IBinding>(null);
            }

            IBinding binding = new TraceWriterBinding(parameter);
            return Task.FromResult(binding);
        }
コード例 #2
0
        public Task <IBinding> TryCreateAsync(BindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ParameterInfo parameter = context.Parameter;

            if (parameter.ParameterType != typeof(TraceWriter) &&
                parameter.ParameterType != typeof(TextWriter))
            {
                return(Task.FromResult <IBinding>(null));
            }

            IBinding binding = new TraceWriterBinding(parameter, _loggerFactory);

            return(Task.FromResult(binding));
        }