internal void Initialize(ICodeGenerationHost host, IEnumerable <DomainServiceDescription> descriptions, ClientCodeGenerationOptions options) { if (host == null) { throw new ArgumentNullException(nameof(host)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } if (descriptions == null) { throw new ArgumentNullException(nameof(descriptions)); } // Initialize all the instance variables this._host = host; this._clientProxyCodeGenerationOptions = options; this._domainServiceDescriptions = descriptions.ToList(); this._compileUnit = new CodeCompileUnit(); this._namespaces = new Dictionary <string, CodeNamespace>(); this._enumTypesToGenerate = new HashSet <Type>(); CodeDomClientCodeGenerator.ValidateOptions(this._clientProxyCodeGenerationOptions); // Unconditionally initialize some options CodeGeneratorOptions cgo = new CodeGeneratorOptions(); cgo.IndentString = " "; cgo.VerbatimOrder = false; cgo.BlankLinesBetweenMembers = true; cgo.BracingStyle = "C"; this._options = cgo; // Choose the provider for the language. C# is the default if unspecified. string language = this.ClientProxyCodeGenerationOptions.Language; bool isCSharp = String.IsNullOrEmpty(language) || String.Equals(language, "C#", StringComparison.OrdinalIgnoreCase); this._provider = isCSharp ? (CodeDomProvider) new CSharpCodeProvider() : (CodeDomProvider) new VBCodeProvider(); // Configure our code gen utility package CodeGenUtilities.Initialize(!this.IsCSharp, this.ClientProxyCodeGenerationOptions.UseFullTypeNames, this.ClientProxyCodeGenerationOptions.ClientRootNamespace); }