private void GenerateCodeRecursive(ProtoFile proto)
        {
            foreach (var item in proto.ImportedFiles)
            {
                GenerateCodeRecursive(item);
            }

            var typeGenerator = new TypeGenerator(proto, _options.ModelOptions);

            typeGenerator.GenerateCode();

            if (_options.ServiceOptions != null)
            {
                var serviceGenerator = new ServiceGenerator(proto, _options.ServiceOptions, typeGenerator);
                serviceGenerator.GenerateCode();

                if (_options.ControllerOptions != null)
                {
                    var controlller = new WebApiControllerGenerator(proto, _options.ControllerOptions, serviceGenerator, typeGenerator);
                    controlller.GenerateCode();

                    if (_options.ClientOptions != null)
                    {
                        var client = new ClientGenerator(proto, _options.ClientOptions, serviceGenerator, typeGenerator);
                        client.GenerateCode();

                        if (_options.ApiGatewayOptions != null)
                        {
                            new ApiGatewayGenerator(proto, _options.ApiGatewayOptions, serviceGenerator, typeGenerator, client)
                            .GenerateCode();
                        }
                    }
                }
            }
        }
Exemple #2
0
        public ClientGenerator(ProtoFile proto, TypeGeneratorOption option, ServiceGenerator serviceGenerator, TypeGenerator typeGenerator)
            : base(proto, option)
        {
            _serviceGenerator = serviceGenerator;
            _typeGenerator    = typeGenerator;

            Namespace = option.Namespace ?? $"{proto.Option.Namespace}.Clients";
        }
Exemple #3
0
 public ApiGatewayGenerator(ProtoFile proto,
                            ApiGateWayGeneratorOption option,
                            ServiceGenerator serviceGenerator,
                            TypeGenerator typeGenerator,
                            ClientGenerator clientGenerator)
     : base(proto, option, serviceGenerator, typeGenerator)
 {
     _clientGenerator = clientGenerator;
 }
 public WebApiControllerGenerator(ProtoFile proto, WebApiControllerGeneratorOption option,
                                  ServiceGenerator serviceGenerator, TypeGenerator typeGenerator) : base(proto, option)
 {
     _serviceGenerator = serviceGenerator;
     _typeGenerator    = typeGenerator;
 }