Пример #1
0
        private CorrelationPropertyValue[] GetCorrelationProperties(Type interfaceType, string methodName)
        {
            CorrelationPropertyValue[] correlationProperties = null;

            if (interfaceType.GetCustomAttributes(typeof(ExternalDataExchangeAttribute), true).Length == 0)
            {
                throw new InvalidOperationException(SR.GetString(SR.Error_ExternalDataExchangeException, interfaceType.AssemblyQualifiedName));
            }

            List <Object> correlationParamAttributes = new List <Object>();

            correlationParamAttributes.AddRange(GetCorrelationParameterAttributes(interfaceType));

            if (correlationParamAttributes.Count == 0)
            {
                throw new InvalidOperationException(SR.GetString(SR.Error_CorrelationParameterException, interfaceType.AssemblyQualifiedName));
            }

            correlationProperties = new CorrelationPropertyValue[correlationParamAttributes.Count];

            Dictionary <String, CorrelationAliasAttribute> corrAliases = null;
            MethodInfo methodInfo = null;

            GetMethodInfo(interfaceType, methodName, out methodInfo, out corrAliases);

            if (methodInfo == null)
            {
                throw new MissingMethodException(interfaceType.AssemblyQualifiedName, methodName);
            }

            ParameterInfo[] parameters = methodInfo.GetParameters();

            int i = 0;

            foreach (CorrelationParameterAttribute paramAttribute in correlationParamAttributes)
            {
                String location = paramAttribute.Name;
                CorrelationAliasAttribute aliasAttribute = GetMatchingCorrelationAlias(paramAttribute, corrAliases, correlationParamAttributes.Count == 1);

                if (aliasAttribute != null)
                {
                    location = aliasAttribute.Path;
                }

                CorrelationPropertyValue value = GetCorrelationProperty(parameters, paramAttribute.Name, location);
                if (value == null)
                {
                    throw new InvalidOperationException(SR.GetString(SR.Error_CorrelationParameterException, interfaceType.AssemblyQualifiedName, paramAttribute.Name, methodName));
                }

                correlationProperties[i++] = value;
            }
            return(correlationProperties);
        }
        private CorrelationPropertyValue[] GetCorrelationProperties(Type interfaceType, string methodName)
        {
            CorrelationPropertyValue[] valueArray = null;
            if (interfaceType.GetCustomAttributes(typeof(ExternalDataExchangeAttribute), true).Length == 0)
            {
                throw new InvalidOperationException(SR.GetString("Error_ExternalDataExchangeException", new object[] { interfaceType.AssemblyQualifiedName }));
            }
            List <object> list = new List <object>();

            list.AddRange(this.GetCorrelationParameterAttributes(interfaceType));
            if (list.Count == 0)
            {
                throw new InvalidOperationException(SR.GetString("Error_CorrelationParameterException", new object[] { interfaceType.AssemblyQualifiedName }));
            }
            valueArray = new CorrelationPropertyValue[list.Count];
            Dictionary <string, CorrelationAliasAttribute> correlationAliases = null;
            MethodInfo methodInfo = null;

            this.GetMethodInfo(interfaceType, methodName, out methodInfo, out correlationAliases);
            if (methodInfo == null)
            {
                throw new MissingMethodException(interfaceType.AssemblyQualifiedName, methodName);
            }
            ParameterInfo[] parameters = methodInfo.GetParameters();
            int             num        = 0;

            foreach (CorrelationParameterAttribute attribute in list)
            {
                string name = attribute.Name;
                CorrelationAliasAttribute attribute2 = this.GetMatchingCorrelationAlias(attribute, correlationAliases, list.Count == 1);
                if (attribute2 != null)
                {
                    name = attribute2.Path;
                }
                CorrelationPropertyValue value2 = this.GetCorrelationProperty(parameters, attribute.Name, name);
                if (value2 == null)
                {
                    throw new InvalidOperationException(SR.GetString("Error_CorrelationParameterException", new object[] { interfaceType.AssemblyQualifiedName, attribute.Name, methodName }));
                }
                valueArray[num++] = value2;
            }
            return(valueArray);
        }
        private CorrelationPropertyValue[] GetCorrelationProperties(Type interfaceType, string methodName)
        {
            CorrelationPropertyValue[] correlationProperties = null;

            if (interfaceType.GetCustomAttributes(typeof(ExternalDataExchangeAttribute), true).Length == 0)
                throw new InvalidOperationException(SR.GetString(SR.Error_ExternalDataExchangeException, interfaceType.AssemblyQualifiedName));

            List<Object> correlationParamAttributes = new List<Object>();
            correlationParamAttributes.AddRange(GetCorrelationParameterAttributes(interfaceType));

            if (correlationParamAttributes.Count == 0)
                throw new InvalidOperationException(SR.GetString(SR.Error_CorrelationParameterException, interfaceType.AssemblyQualifiedName));

            correlationProperties = new CorrelationPropertyValue[correlationParamAttributes.Count];

            Dictionary<String, CorrelationAliasAttribute> corrAliases = null;
            MethodInfo methodInfo = null;

            GetMethodInfo(interfaceType, methodName, out methodInfo, out corrAliases);

            if (methodInfo == null)
            {
                throw new MissingMethodException(interfaceType.AssemblyQualifiedName, methodName);
            }

            ParameterInfo[] parameters = methodInfo.GetParameters();

            int i = 0;
            foreach (CorrelationParameterAttribute paramAttribute in correlationParamAttributes)
            {
                String location = paramAttribute.Name;
                CorrelationAliasAttribute aliasAttribute = GetMatchingCorrelationAlias(paramAttribute, corrAliases, correlationParamAttributes.Count == 1);

                if (aliasAttribute != null)
                    location = aliasAttribute.Path;

                CorrelationPropertyValue value = GetCorrelationProperty(parameters, paramAttribute.Name, location);
                if (value == null)
                    throw new InvalidOperationException(SR.GetString(SR.Error_CorrelationParameterException, interfaceType.AssemblyQualifiedName, paramAttribute.Name, methodName));

                correlationProperties[i++] = value;
            }
            return correlationProperties;
        }