Example #1
0
 public static DocumentGenerator Create(ContractDefinition contract = null)
 {
     return new DocumentGenerator
     {
         ContractDefinition = contract
     };
 }
Example #2
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);
            }
        }
Example #3
0
 public MethodDescriptor(ContractDefinition contract, MethodInfo method, string name)
 {
     Contract = contract;
     Method = method;
     Name = name;
 }
Example #4
0
 public MethodDescriptor GetMethodDescriptor(ContractDefinition contract, MethodInfo method)
 {
     return new MethodDescriptor(contract, method, method.Name);
 }
Example #5
0
 public ContractExecution(ContractDefinition definition)
 {
     Definition = definition;
 }
Example #6
0
 public DocumentGenerator Proxy(ContractDefinition definition = null, ClassDescriptor descriptor = null, bool forceAsync = false)
 {
     return AddContractGenerator(new ProxyGenerator(Output, Formatter, IntendProvider)
     {
         ContractDefinition = definition ?? ContractDefinition,
         ContractDescriptor = descriptor,
         ForceAsync = forceAsync
     });
 }
Example #7
0
 public override string GetFileName(ContractDefinition definition)
 {
     return $"{definition.Name}.Proxy.Designer.cs";
 }
Example #8
0
 private ContractDefinition CoerceDescriptor(ContractDefinition definition)
 {
     return new ContractDefinition(definition.Root, definition.ExcludedContracts.Concat(GetExcludedTypes()).Distinct().ToArray());
 }
Example #9
0
 public abstract string GetFileName(ContractDefinition definition);
Example #10
0
 protected internal abstract void DoExecute(DocumentGenerator generator, ContractDefinition definition);