示例#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)));
        }
示例#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));
        }
示例#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));
        }
示例#4
0
 public ServerType(Type type)
 {
     this.type = TypeStubManager.GetLogicalTypeInfo(type);
 }