Beispiel #1
0
        TrackingParticipant CreateTrackingComponent(TrackingComponentElement participantElement)
        {
            if (participantElement.ComponentRuntimeType == null)
            {
                participantElement.ComponentRuntimeType = System.Type.GetType(participantElement.Type);
                if (participantElement.ComponentRuntimeType == null)
                {
                    throw new InvalidOperationException("Tracking component type not found");
                }
            }

            if (CheckType(participantElement.ComponentRuntimeType, typeof(TrackingParticipant)))
            {
                if ((participantElement.TrackingComponentArguments != null) && (participantElement.TrackingComponentArguments.Count != 0))
                {
                    ConstructorInfo cInfo = participantElement.ComponentRuntimeType.GetConstructor(new Type[] { typeof(NameValueCollection) });
                    if (cInfo != null)
                    {
                        return(cInfo.Invoke(new object[] { participantElement.TrackingComponentArguments }) as TrackingParticipant);
                    }
                }
                else
                {
                    ConstructorInfo cInfo = participantElement.ComponentRuntimeType.GetConstructor(new Type[] { });

                    if (cInfo != null)
                    {
                        return(cInfo.Invoke(null) as TrackingParticipant);
                    }
                }
            }
            return(null);
        }
        protected override void Unmerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
        {
            TrackingComponentElement trackingElement = (TrackingComponentElement)sourceElement;

            this.trackingComponentArguments = new NameValueCollection(trackingElement.trackingComponentArguments);
            this.argumentsHash = trackingElement.argumentsHash;
            base.Unmerge(sourceElement, parentElement, saveMode);
        }
        TrackingParticipant CreateTrackingComponent(TrackingComponentElement participantElement)
        {
            if (participantElement.ComponentRuntimeType == null)
            {
                participantElement.ComponentRuntimeType = System.Type.GetType(participantElement.Type);
                if (participantElement.ComponentRuntimeType == null)
                {
                    throw new InvalidOperationException("Tracking component type not found");
                }
            }

            if (CheckType(participantElement.ComponentRuntimeType, typeof(TrackingParticipant)))
            {
                if ((participantElement.TrackingComponentArguments != null) && (participantElement.TrackingComponentArguments.Count != 0))
                {
                    ConstructorInfo cInfo = participantElement.ComponentRuntimeType.GetConstructor(new Type[] { typeof(NameValueCollection) });
                    if (cInfo != null)
                    {
                        return cInfo.Invoke(new object[] { participantElement.TrackingComponentArguments }) as TrackingParticipant;
                    }
                }
                else
                {
                    ConstructorInfo cInfo = participantElement.ComponentRuntimeType.GetConstructor(new Type[] { });

                    if (cInfo != null)
                    {
                        return cInfo.Invoke(null) as TrackingParticipant;
                    }
                }
            }
            return null;
        }