예제 #1
0
        internal static SoapExtensionRuntimeConfig[][] GetTypeExtensions(Type serviceType)
        {
            if (globalExtensions == null)
            {
                InitializeGlobalExtensions();
            }

            SoapExtensionRuntimeConfig[][] exts = new SoapExtensionRuntimeConfig[2][];

            for (int group = 0; group < 2; group++)
            {
                ArrayList globList = globalExtensions[group];
                if (globList == null)
                {
                    continue;
                }
                exts [group] = new SoapExtensionRuntimeConfig [globList.Count];
                for (int n = 0; n < globList.Count; n++)
                {
                    SoapExtensionTypeElement   econf    = (SoapExtensionTypeElement)globList [n];
                    SoapExtensionRuntimeConfig typeconf = new SoapExtensionRuntimeConfig();
                    typeconf.Type = econf.Type;
                    SoapExtension ext = (SoapExtension)Activator.CreateInstance(econf.Type);
                    typeconf.InitializationInfo = ext.GetInitializer(serviceType);
                    exts [group][n]             = typeconf;
                }
            }
            return(exts);
        }
예제 #2
0
        internal static SoapExtensionRuntimeConfig[] GetMethodExtensions(LogicalMethodInfo method)
        {
            object[] ats = method.GetCustomAttributes(typeof(SoapExtensionAttribute));
            SoapExtensionRuntimeConfig[] exts = new SoapExtensionRuntimeConfig [ats.Length];
            int[] priorities = new int[ats.Length];

            for (int n = 0; n < ats.Length; n++)
            {
                SoapExtensionAttribute     at    = (SoapExtensionAttribute)ats[n];
                SoapExtensionRuntimeConfig econf = new SoapExtensionRuntimeConfig();
                econf.Type     = at.ExtensionType;
                priorities [n] = at.Priority;
                SoapExtension ext = (SoapExtension)Activator.CreateInstance(econf.Type);
                econf.InitializationInfo = ext.GetInitializer(method, at);
                exts [n] = econf;
            }
            Array.Sort(priorities, exts);
            return(exts);
        }
        internal object GetInitializer(LogicalMethodInfo methodInfo)
        {
            SoapExtension extension = (SoapExtension)Activator.CreateInstance(this.type);

            return(extension.GetInitializer(methodInfo, this.attribute));
        }
        internal object GetInitializer(Type serviceType)
        {
            SoapExtension extension = (SoapExtension)Activator.CreateInstance(this.type);

            return(extension.GetInitializer(serviceType));
        }