示例#1
0
        protected internal override void DoExecute(DocumentGenerator generator, ContractDefinition definition)
        {
            ProxyGenerator proxyGenerator = null;
            if (Mode.HasFlag(GenerateContractMode.Proxy))
            {
                proxyGenerator = new ProxyGenerator
                {
                    ForceAsync = ForceAsync,
                    ContractDefinition = definition,
                    Namespace = Namespace,
                    Name = Name,
                    Modifier = GetModifier()
                };

                if (!string.IsNullOrEmpty(Generator))
                {
                    proxyGenerator.UserGenerator = Parent.GetGenerator(Generator);
                }

                if (!string.IsNullOrEmpty(Suffix))
                {
                    proxyGenerator.Suffix = Suffix;
                }
            }

            if (Mode.HasFlag(GenerateContractMode.Interface))
            {
                InterfaceGenerator interfaceGenerator = new InterfaceGenerator
                {
                    ContractDefinition = definition,
                    ForceAsync = ForceAsync,
                    ExcludedInterfaces = ExcludedInterfaces
                };

                generator.Add(interfaceGenerator);
                interfaceGenerator.Generated += (s, e) =>
                    {
                        if (proxyGenerator != null)
                        {
                            proxyGenerator.BaseInterfaces = interfaceGenerator.GeneratedAsyncInterfaces.ToList();
                        }
                    };
            }

            if (proxyGenerator != null)
            {
                generator.Add(proxyGenerator);
            }
        }
示例#2
0
        public DocumentGenerator GetDocument(string output)
        {
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            if (!_documents.ContainsKey(output))
            {
                _documents[output] = new DocumentGenerator();
                if (FullTypeNames)
                {
                    _documents[output].Formatter.ForceFullTypeNames = true;
                }
            }

            return _documents[output];
        }
示例#3
0
 protected internal abstract void DoExecute(DocumentGenerator generator, ContractDefinition definition);