Пример #1
0
 public static DocumentGenerator Create(ContractDefinition contract = null)
 {
     return new DocumentGenerator
     {
         ContractDefinition = contract
     };
 }
Пример #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);
            }
        }
Пример #3
0
 public MethodDescriptor(ContractDefinition contract, MethodInfo method, string name)
 {
     Contract = contract;
     Method = method;
     Name = name;
 }
Пример #4
0
 public MethodDescriptor GetMethodDescriptor(ContractDefinition contract, MethodInfo method)
 {
     return new MethodDescriptor(contract, method, method.Name);
 }
Пример #5
0
 public ContractExecution(ContractDefinition definition)
 {
     Definition = definition;
 }
Пример #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
     });
 }
Пример #7
0
 public override string GetFileName(ContractDefinition definition)
 {
     return $"{definition.Name}.Proxy.Designer.cs";
 }
Пример #8
0
 private ContractDefinition CoerceDescriptor(ContractDefinition definition)
 {
     return new ContractDefinition(definition.Root, definition.ExcludedContracts.Concat(GetExcludedTypes()).Distinct().ToArray());
 }
Пример #9
0
 public abstract string GetFileName(ContractDefinition definition);
Пример #10
0
 protected internal abstract void DoExecute(DocumentGenerator generator, ContractDefinition definition);