コード例 #1
0
        protected ServiceModelCodeGenerator(IDirectory directory, CodeGenerationOptions options)
        {
            this.Options = options;
            this.directory = directory;

            directory.Create(true);
        }
コード例 #2
0
        protected ServiceModelCodeGenerator(TextWriter writer, CodeGenerationOptions options)
        {
            this.Options = options;
            this.writer = new TextWriterWrapper(writer);

            if (writer == Console.Out)
            {
                this.writer.NewLine = "\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;
        }
コード例 #4
0
 public CodeGenerationContext(ServiceModel serviceModel, CodeGenerationOptions options)
 {
     this.Options = options;
     this.ServiceModel = serviceModel;
 }
コード例 #5
0
 public static ServiceModelCodeGenerator GetCodeGenerator(string language, TextWriter writer, CodeGenerationOptions options)
 {
     return GetCodeGenerator(language, (object)writer, options);
 }
コード例 #6
0
 public static ServiceModelCodeGenerator GetCodeGenerator(string language, IFile file, CodeGenerationOptions options)
 {
     return GetCodeGenerator(language, (object)file, options);
 }
コード例 #7
0
 public static ServiceModelCodeGenerator GetCodeGenerator(string language, IDirectory directory, CodeGenerationOptions options)
 {
     return GetCodeGenerator(language, (object)directory, options);
 }
コード例 #8
0
 protected ServiceModelCodeGenerator(IFile file, CodeGenerationOptions options)
     : this(file.GetContent().GetWriter(), options)
 {
 }