protected abstract void GenerateGateway(CodeGenerationContext codeGenerationContext, TypeDefinitionExpression expression);
public virtual void Generate(ServiceModel serviceModel) { serviceModel = this.ProcessPregeneration(serviceModel); var codeGenerationContext = new CodeGenerationContext(serviceModel, this.Options); var serviceExpressionBuilder = new ServiceExpressionBuilder(serviceModel, this.Options); if (this.Options.GenerateClasses) { foreach (var expression in serviceModel.Classes.Select(serviceExpressionBuilder.Build) .Cast <TypeDefinitionExpression>()) { var currentExpression = expression; this.GenerateClass(codeGenerationContext, currentExpression); } } if (this.Options.GenerateGateways) { foreach (var expression in serviceModel.Gateways.Select(serviceExpressionBuilder.Build) .Cast <TypeDefinitionExpression>()) { var currentExpression = expression; this.GenerateGateway(codeGenerationContext, currentExpression); } } if (this.Options.GenerateEnums) { foreach (var expression in serviceModel.Enums.Select(serviceExpressionBuilder.Build).Cast <TypeDefinitionExpression>()) { var currentExpression = expression; this.GenerateEnum(codeGenerationContext, currentExpression); } } var assembly = Assembly.GetExecutingAssembly(); var prefix = this.GetType().Namespace + ".Prelude."; foreach (var resourceName in assembly.GetManifestResourceNames() .Where(resourceName => resourceName.StartsWith(prefix)) .Where(resourceName => this.IncludePreludeResource(resourceName.Substring(prefix.Length)))) { using (var input = new StreamReader(assembly.GetManifestResourceStream(resourceName))) { var index = resourceName.LastIndexOf('.', resourceName.Length - 3); using (var output = this.GetTextWriterForFile(resourceName.Substring(index + 1))) { int x; while ((x = input.Read()) != -1) { output.Write((char)x); } } } } }
public virtual void Generate(ServiceModel serviceModel) { serviceModel = this.ProcessPregeneration(serviceModel); var codeGenerationContext = new CodeGenerationContext(serviceModel, this.Options); var serviceExpressionBuilder = new ServiceExpressionBuilder(serviceModel, this.Options); if (this.Options.GenerateClasses) { foreach (var expression in serviceModel.Classes.Select(serviceExpressionBuilder.Build) .Cast<TypeDefinitionExpression>()) { var currentExpression = expression; this.GenerateClass(codeGenerationContext, currentExpression); } } if (this.Options.GenerateGateways) { foreach (var expression in serviceModel.Gateways.Select(serviceExpressionBuilder.Build) .Cast<TypeDefinitionExpression>()) { var currentExpression = expression; this.GenerateGateway(codeGenerationContext, currentExpression); } } if (this.Options.GenerateEnums) { foreach (var expression in serviceModel.Enums.Select(serviceExpressionBuilder.Build).Cast<TypeDefinitionExpression>()) { var currentExpression = expression; this.GenerateEnum(codeGenerationContext, currentExpression); } } var assembly = Assembly.GetExecutingAssembly(); var prefix = this.GetType().Namespace + ".Prelude."; foreach (var resourceName in assembly.GetManifestResourceNames().Where(resourceName => resourceName.StartsWith(prefix))) { using (var input = new StreamReader(assembly.GetManifestResourceStream(resourceName))) { using (var output = this.GetTextWriterForFile(resourceName.Substring(prefix.Length))) { int x; while ((x = input.Read()) != -1) { output.Write((char)x); } } } } }