Exemplo n.º 1
0
        public bool Load()
        {
            Type   lType         = ONContext.GetType(mComponentType, mClassName);
            string lXmlAttribute = "<Class>" + mClassName + "</Class>";

            bool lFinded = false;

            foreach (MethodInfo lMethodInfo in lType.GetMethods())
            {
                foreach (IONAttribute lAttribute in lMethodInfo.GetCustomAttributes(typeof(IONAttribute), true))
                {
                    Type lAttributeType = lAttribute.GetType();
                    lFinded = true;

                    // Triggers
                    if ((lAttributeType == typeof(ONTriggerAttribute) || lAttributeType.IsSubclassOf(typeof(ONTriggerAttribute))) && (string.Compare(lAttribute.ToString(), lXmlAttribute, true) == 0))
                    {
                        mMethodInfoTriggers.Add(lMethodInfo);
                    }

                    // IntegrityConstraints
                    if ((lAttributeType == typeof(ONIntegrityConstraintAttribute) || lAttributeType.IsSubclassOf(typeof(ONIntegrityConstraintAttribute))) && (string.Compare(lAttribute.ToString(), lXmlAttribute, true) == 0))
                    {
                        mMethodInfoIntegrityConstraints.Add(lMethodInfo);
                    }
                }
            }

            return(lFinded);
        }
Exemplo n.º 2
0
        public bool Load()
        {
            Type   lType         = ONContext.GetType(mComponentType, mClassName);
            string lXmlAttribute = "<Class>" + mClassName + "</Class><Service>" + mServiceName + "</Service>";

            bool lFinded = false;

            foreach (MethodInfo lMethodInfo in lType.GetMethods())
            {
                foreach (IONAttribute lAttribute in lMethodInfo.GetCustomAttributes(typeof(IONAttribute), true))
                {
                    Type lAttributeType = lAttribute.GetType();
                    lFinded = true;

                    // STD
                    if ((lAttributeType == typeof(ONSTDAttribute) || lAttributeType.IsSubclassOf(typeof(ONSTDAttribute))) && (string.Compare(lAttribute.ToString(), lXmlAttribute, true) == 0))
                    {
                        mMethodInfoSTD.Add(lMethodInfo);
                    }

                    // Precondition
                    if ((lAttributeType == typeof(ONPreconditionAttribute) || lAttributeType.IsSubclassOf(typeof(ONPreconditionAttribute))) && (string.Compare(lAttribute.ToString(), lXmlAttribute, true) == 0))
                    {
                        mMethodInfoPrecondition.Add(lMethodInfo);
                    }

                    // Check State
                    if ((lAttributeType == typeof(ONCheckStateAttribute) || lAttributeType.IsSubclassOf(typeof(ONCheckStateAttribute))) && (string.Compare(lAttribute.ToString(), lXmlAttribute, true) == 0))
                    {
                        mMethodInfoCheckState.Add(lMethodInfo);
                    }

                    // Service
                    if ((lAttributeType == typeof(ONServiceAttribute) || lAttributeType.IsSubclassOf(typeof(ONServiceAttribute))) && (string.Compare(lAttribute.ToString(), lXmlAttribute, true) == 0))
                    {
                        mMethodInfoService.Add(lMethodInfo);
                    }

                    // OutboundArguments
                    if ((lAttributeType == typeof(ONOutboundArgumentsAttribute) || lAttributeType.IsSubclassOf(typeof(ONOutboundArgumentsAttribute))) && (string.Compare(lAttribute.ToString(), lXmlAttribute, true) == 0))
                    {
                        mMethodInfoOutboundArguments.Add(lMethodInfo);
                    }
                }
            }

            return(lFinded);
        }