예제 #1
0
        public override string ToString()
        {
            if (OperationTypes == null || OperationTypes.Count == 0)
            {
                return(null);
            }

            var uniqueTypes     = new List <Type>();
            var uniqueTypeNames = new List <string>();

            foreach (var type in OperationTypes)
            {
                foreach (var assemblyType in type.Assembly.GetTypes())
                {
                    if (assemblyType.GetCustomAttributes(typeof(DataContractAttribute), false).Length > 0)
                    {
                        var baseTypeWithSameName = XsdMetadata.GetBaseTypeWithTheSameName(assemblyType);
                        if (uniqueTypeNames.Contains(baseTypeWithSameName.Name))
                        {
                            log.WarnFormat("Skipping duplicate type with existing name '{0}'", baseTypeWithSameName.Name);
                        }
                        uniqueTypes.Add(baseTypeWithSameName);
                    }
                }
            }
            this.OperationTypes = uniqueTypes;

            var schemaSet   = XsdUtils.GetXmlSchemaSet(OperationTypes);
            var xsd         = XsdUtils.GetXsd(schemaSet);
            var filteredXsd = Filter(xsd);

            return(filteredXsd);
        }
예제 #2
0
        public override string ToString()
        {
            if (OperationTypes == null || OperationTypes.Count == 0)
            {
                return(null);
            }

            var uniqueTypes     = new HashSet <Type>();
            var uniqueTypeNames = new List <string>();

            foreach (var opType in OperationTypes)
            {
                var refTypes = opType.GetReferencedTypes();
                foreach (var type in refTypes)
                {
                    if (type.IsDto())
                    {
                        var baseTypeWithSameName = XsdMetadata.GetBaseTypeWithTheSameName(type);
                        if (uniqueTypeNames.Contains(baseTypeWithSameName.GetOperationName()))
                        {
                            Logger.WarnFormat("Skipping duplicate type with existing name '{0}'", baseTypeWithSameName.GetOperationName());
                        }

                        if (!baseTypeWithSameName.IsGenericTypeDefinition && !baseTypeWithSameName.AllAttributes <ExcludeAttribute>().
                            Any(attr => attr.Feature.Has(Feature.Soap)))
                        {
                            uniqueTypes.Add(baseTypeWithSameName);
                        }
                    }
                }
            }

            this.OperationTypes = uniqueTypes;

            var schemaSet   = XsdUtils.GetXmlSchemaSet(OperationTypes);
            var xsd         = XsdUtils.GetXsd(schemaSet);
            var filteredXsd = Filter(xsd);

            return(filteredXsd);
        }
예제 #3
0
        public override string ToString()
        {
            if (OperationTypes == null || OperationTypes.Count == 0)
            {
                return(null);
            }

            var uniqueTypes     = new HashSet <Type>();
            var uniqueTypeNames = new List <string>();

            foreach (var opType in OperationTypes)
            {
                var refTypes = opType.GetReferencedTypes();
                foreach (var type in refTypes)
                {
                    if (type.IsDto())
                    {
                        var baseTypeWithSameName = XsdMetadata.GetBaseTypeWithTheSameName(type);
                        if (uniqueTypeNames.Contains(baseTypeWithSameName.GetOperationName()))
                        {
                            log.WarnFormat("Skipping duplicate type with existing name '{0}'", baseTypeWithSameName.GetOperationName());
                        }

                        if (HostContext.AppHost.ExportSoapType(baseTypeWithSameName))
                        {
                            uniqueTypes.Add(baseTypeWithSameName);
                        }
                    }
                }
            }

            this.OperationTypes = uniqueTypes;

            var schemaSet   = XsdUtils.GetXmlSchemaSet(OperationTypes);
            var xsd         = XsdUtils.GetXsd(schemaSet);
            var filteredXsd = Filter(xsd);

            return(filteredXsd);
        }