From cf3490ac415c31f7672187e80cab4a9aa9f23719 Mon Sep 17 00:00:00 2001 From: yangxiaodong Date: Tue, 22 Aug 2017 16:57:13 +0800 Subject: [PATCH] delete unused fiels. --- .../Internal/ConsumerMethodExecutor.cs | 36 ------ .../Internal/ModelAttributes.cs | 104 ------------------ 2 files changed, 140 deletions(-) delete mode 100644 src/DotNetCore.CAP/Internal/ConsumerMethodExecutor.cs delete mode 100644 src/DotNetCore.CAP/Internal/ModelAttributes.cs diff --git a/src/DotNetCore.CAP/Internal/ConsumerMethodExecutor.cs b/src/DotNetCore.CAP/Internal/ConsumerMethodExecutor.cs deleted file mode 100644 index adef725..0000000 --- a/src/DotNetCore.CAP/Internal/ConsumerMethodExecutor.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Extensions.Internal; - -namespace DotNetCore.CAP.Internal -{ - public class ConsumerMethodExecutor - { - internal static object[] PrepareArguments( - IDictionary actionParameters, - ObjectMethodExecutor actionMethodExecutor) - { - var declaredParameterInfos = actionMethodExecutor.MethodParameters; - var count = declaredParameterInfos.Length; - if (count == 0) - { - return null; - } - - var arguments = new object[count]; - for (var index = 0; index < count; index++) - { - var parameterInfo = declaredParameterInfos[index]; - object value; - - if (!actionParameters.TryGetValue(parameterInfo.Name, out value)) - { - value = actionMethodExecutor.GetDefaultValueForParameter(index); - } - - arguments[index] = value; - } - - return arguments; - } - } -} \ No newline at end of file diff --git a/src/DotNetCore.CAP/Internal/ModelAttributes.cs b/src/DotNetCore.CAP/Internal/ModelAttributes.cs deleted file mode 100644 index 756f654..0000000 --- a/src/DotNetCore.CAP/Internal/ModelAttributes.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace DotNetCore.CAP.Internal -{ - /// - /// Provides access to the combined list of attributes associated a or property. - /// - public class ModelAttributes - { - /// - /// Creates a new for a . - /// - /// The set of attributes for the . - public ModelAttributes(IEnumerable typeAttributes) - { - Attributes = typeAttributes?.ToArray() ?? throw new ArgumentNullException(nameof(typeAttributes)); - TypeAttributes = Attributes; - } - - /// - /// Creates a new for a property. - /// - /// The set of attributes for the property. - /// - /// The set of attributes for the property's . See . - /// - public ModelAttributes(IEnumerable propertyAttributes, IEnumerable typeAttributes) - { - PropertyAttributes = propertyAttributes?.ToArray() - ?? throw new ArgumentNullException(nameof(propertyAttributes)); - - TypeAttributes = typeAttributes?.ToArray() - ?? throw new ArgumentNullException(nameof(typeAttributes)); - - Attributes = PropertyAttributes.Concat(TypeAttributes).ToArray(); - } - - /// - /// Gets the set of all attributes. If this instance represents the attributes for a property, the attributes - /// on the property definition are before those on the property's . - /// - public IReadOnlyList Attributes { get; } - - /// - /// Gets the set of attributes on the property, or null if this instance represents the attributes - /// for a . - /// - public IReadOnlyList PropertyAttributes { get; } - - /// - /// Gets the set of attributes on the . If this instance represents a property, - /// then contains attributes retrieved from - /// . - /// - public IReadOnlyList TypeAttributes { get; } - - /// - /// Gets the attributes for the given . - /// - /// The in which caller found . - /// - /// A for which attributes need to be resolved. - /// - /// A instance with the attributes of the property. - public static ModelAttributes GetAttributesForProperty(Type type, PropertyInfo property) - { - if (type == null) - { - throw new ArgumentNullException(nameof(type)); - } - - if (property == null) - { - throw new ArgumentNullException(nameof(property)); - } - - var propertyAttributes = property.GetCustomAttributes(); - var typeAttributes = property.PropertyType.GetTypeInfo().GetCustomAttributes(); - - return new ModelAttributes(propertyAttributes, typeAttributes); - } - - /// - /// Gets the attributes for the given . - /// - /// The for which attributes need to be resolved. - /// - /// A instance with the attributes of the . - public static ModelAttributes GetAttributesForType(Type type) - { - if (type == null) - { - throw new ArgumentNullException(nameof(type)); - } - - var attributes = type.GetTypeInfo().GetCustomAttributes(); - - return new ModelAttributes(attributes); - } - } -} \ No newline at end of file