Exemplo n.º 1
0
        protected ServiceModelCodeGenerator(IDirectory directory, CodeGenerationOptions options)
        {
            this.Options = options;
            this.directory = directory;

            directory.Create(true);
        }
Exemplo n.º 2
0
        protected ServiceModelCodeGenerator(TextWriter writer, CodeGenerationOptions options)
        {
            this.Options = options;
            this.writer = new TextWriterWrapper(writer);

            if (writer == Console.Out)
            {
                this.writer.NewLine = "\n";
            }
        }
Exemplo n.º 3
0
        public static ServiceModelCodeGenerator GetCodeGenerator(string language, object param, CodeGenerationOptions options)
        {
            var types = typeof(ServiceModelCodeGenerator).Assembly.GetTypes();
            var serviceModelCodeGeneratorTypes = types.Where(c => typeof(ServiceModelCodeGenerator).IsAssignableFrom(c));

            var generatorType = serviceModelCodeGeneratorTypes.FirstOrDefault(delegate(Type type)
            {
                if (Regex.Match(type.Name, language + "ServiceModelCodeGenerator$", RegexOptions.IgnoreCase).Success)
                {
                    return true;
                }

                var attribute = type.GetFirstCustomAttribute<ServiceModelCodeGeneratorAttribute>(true);

                return attribute != null && attribute.Aliases.FirstOrDefault(c => c.Equals(language, StringComparison.InvariantCultureIgnoreCase)) != null;
            });

            if (generatorType != null)
            {
                return (ServiceModelCodeGenerator)Activator.CreateInstance(generatorType, param, options);
            }

            return null;
        }
Exemplo n.º 4
0
 public CodeGenerationContext(ServiceModel serviceModel, CodeGenerationOptions options)
 {
     this.Options = options;
     this.ServiceModel = serviceModel;
 }
Exemplo n.º 5
0
 public static ServiceModelCodeGenerator GetCodeGenerator(string language, TextWriter writer, CodeGenerationOptions options)
 {
     return GetCodeGenerator(language, (object)writer, options);
 }
Exemplo n.º 6
0
 public static ServiceModelCodeGenerator GetCodeGenerator(string language, IFile file, CodeGenerationOptions options)
 {
     return GetCodeGenerator(language, (object)file, options);
 }
Exemplo n.º 7
0
 public static ServiceModelCodeGenerator GetCodeGenerator(string language, IDirectory directory, CodeGenerationOptions options)
 {
     return GetCodeGenerator(language, (object)directory, options);
 }
Exemplo n.º 8
0
 protected ServiceModelCodeGenerator(IFile file, CodeGenerationOptions options)
     : this(file.GetContent().GetWriter(), options)
 {
 }