예제 #1
0
        /// <summary>
        /// Get id for setter of given property.
        /// </summary>
        /// <param name="propertyType">Type of property.</param>
        /// <param name="property">Property which setter is needed.</param>
        /// <returns>MethodID of desired property.</returns>
        private MethodID getSetterID(TypeDescriptor propertyType, string property)
        {
            var parameters = new ParameterTypeInfo[] { ParameterTypeInfo.Create("value", propertyType) };
            var setterID   = Naming.Method(ComponentType, Naming.SetterPrefix + property, false, parameters);

            return(setterID);
        }
예제 #2
0
        /// <summary>
        /// Get parameters info for given method base.
        /// </summary>
        /// <param name="method">Base method which parameters will be created.</param>
        /// <returns>Created parameters info.</returns>
        private static ParameterTypeInfo[] getParametersInfo(MethodBase method)
        {
            var paramsInfo = new List <ParameterTypeInfo>();

            foreach (var param in method.GetParameters())
            {
                //TODO resolve generic arguments
                var paramType = TypeDescriptor.Create(param.ParameterType);
                var paramInfo = ParameterTypeInfo.From(param, paramType);
                paramsInfo.Add(paramInfo);
            }
            return(paramsInfo.ToArray());
        }
예제 #3
0
        /// <summary>
        /// Set importing constructor of component.
        /// </summary>
        /// <param name="importingParameters">Parameters of import.</param>
        public void SetImportingCtor(params TypeDescriptor[] importingParameters)
        {
            var parameters = new ParameterTypeInfo[importingParameters.Length];

            for (int i = 0; i < parameters.Length; ++i)
            {
                var importType = importingParameters[i];
                parameters[i] = ParameterTypeInfo.Create("p", importType);

                addPreImport(importType);
            }

            _importingCtor = Naming.Method(ComponentType, Naming.CtorName, false, parameters);
        }