Exemple #1
0
        public override object GetInitializer(LogicalMethodInfo methodInfo)
        {
            LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo(methodInfo.DeclaringType);

            object[]         ats  = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true);
            XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null;

            return(new XmlSerializer(methodInfo.ReturnType, null, null, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace)));
        }
Exemple #2
0
        public override object GetInitializer(LogicalMethodInfo methodInfo)
        {
            LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo(methodInfo.DeclaringType);

            object[]         ats  = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true);
            XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null;

            XmlReflectionImporter importer = new XmlReflectionImporter();

            importer.IncludeTypes(methodInfo.CustomAttributeProvider);
            XmlTypeMapping map = importer.ImportTypeMapping(methodInfo.ReturnType, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace));

            return(new XmlSerializer(map));
        }
Exemple #3
0
        public override object[] GetInitializers(LogicalMethodInfo[] methodInfos)
        {
            XmlReflectionImporter importer = new XmlReflectionImporter();

            XmlMapping[] sers = new XmlMapping [methodInfos.Length];
            for (int n = 0; n < sers.Length; n++)
            {
                LogicalMethodInfo metinfo = methodInfos[n];
                if (metinfo.IsVoid)
                {
                    sers[n] = null;
                }
                else
                {
                    LogicalTypeInfo  sti  = TypeStubManager.GetLogicalTypeInfo(metinfo.DeclaringType);
                    object[]         ats  = methodInfos[n].ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true);
                    XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null;
                    sers[n] = importer.ImportTypeMapping(methodInfos[n].ReturnType, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace));
                }
            }
            return(XmlSerializer.FromMappings(sers));
        }
Exemple #4
0
 public ServerType(Type type)
 {
     this.type = TypeStubManager.GetLogicalTypeInfo(type);
 }