예제 #1
0
        private string DetermineOperationName(MethodInfo method)
        {
            bool isMethodOverloaded = false;

            try {
                method.DeclaringType.GetMethod(method.Name, BindingFlags.Public | BindingFlags.Instance);
            } catch (AmbiguousMatchException) {
                isMethodOverloaded = true;
            }
            string mappedName =
                IdlNaming.GetMethodRequestOperationName(method, isMethodOverloaded);

            return(mappedName);
        }
예제 #2
0
        /** gets the fully qualified name for the symbol with the symbolName
         * This method checks if the symbol is present in the Scope and throws an error if not
         */
        public String GetFullyQualifiedNameForSymbol(String symbolName)
        {
            if (getSymbol(symbolName) == null)
            {
                throw new InternalCompilerException("error in scope " + this + ", symbol with name: " + symbolName + " not found");
            }
            String namespaceName = GetFullyQualifiedScopeName();
            String fullyQualName = namespaceName;

            if (fullyQualName.Length > 0)
            {
                fullyQualName += ".";
            }
            fullyQualName += IdlNaming.MapIdlNameToClsName(symbolName);
            return(fullyQualName);
        }
예제 #3
0
        /// <summary>returns the fully qualified CLS name of this scope (usable for type generation)</summary>
        /// <remarks>for type-scopes, returns the nested scope name, because this one is needed for type generation</remarks>
        private String GetFullyQualifiedScopeName()
        {
            string result = "";

            for (Scope scope = this; scope.getParentScope() != null; scope = scope.getParentScope())
            {
                string scopeName = IdlNaming.MapIdlNameToClsName(scope.getTypeScopeName());
                if (result == "")
                {
                    result = scopeName;
                }
                else
                {
                    result = scopeName + '.' + result;
                }
            }

            return(result);
        }
예제 #4
0
        private void DetermineMapping(Type forType, SerializerFactory serFactory)
        {
            MethodInfo[] methods =
                forType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
            for (int i = 0; i < methods.Length; i++)
            {
                if (methods[i].IsSpecialName)
                {
                    continue;
                }
                if (IgnoreMethod(methods[i]))
                {
                    // don't support remote calls for method
                    continue;
                }
                string operationName = DetermineOperationName(methods[i]);
                StoreMethodMappingFor(methods[i], operationName, serFactory);
            }

            PropertyInfo[] properties =
                forType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
            for (int i = 0; i < properties.Length; i++)
            {
                if (IgnoreProperty(properties[i]))
                {
                    // don't support remote calls for this property
                    continue;
                }
                MethodInfo getter = properties[i].GetGetMethod();
                MethodInfo setter = properties[i].GetSetMethod();
                if (getter != null)
                {
                    string operationName = IdlNaming.GetPropertyRequestOperationName(properties[i], false);
                    StoreMethodMappingFor(getter, operationName, serFactory);
                }
                if (setter != null)
                {
                    string operationName = IdlNaming.GetPropertyRequestOperationName(properties[i], true);
                    StoreMethodMappingFor(setter, operationName, serFactory);
                }
            }
        }