Пример #1
0
        public override string ToString()
        {
            if (OperationTypes == null || OperationTypes.Count == 0)
            {
                return(null);
            }

            if (IncludeAllTypesInAssembly)
            {
                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 = ServiceOperations.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);
        }
Пример #4
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 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.GetOperationName()))
                        {
                            log.WarnFormat("Skipping duplicate type with existing name '{0}'", baseTypeWithSameName.GetOperationName());
                        }
                        uniqueTypes.Add(baseTypeWithSameName);
                    }
                }
            }

            uniqueTypes.RemoveWhere(x => x.IsGenericTypeDefinition());

            this.OperationTypes = uniqueTypes;

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

            return(filteredXsd);
        }