예제 #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);