private void CreateProxy() { foreach (var contractDescription in ContractDescriptions) { contractGenerator.GenerateServiceContractType(contractDescription); ContractDescription = contractDescription; } bool success = true; CodeGenerationWarnings = contractGenerator.Errors; if (CodeGenerationWarnings != null) { foreach (var error in CodeGenerationWarnings) { if (!error.IsWarning) { success = false; break; } } } if (!success) { var exception = new DynamicProxyException(DynamicErrorMessages.CodeGenerationError); exception.CodeGenerationErrors = CodeGenerationWarnings; throw exception; } }
private void ImportMetadata() { var metadataSet = new MetadataSet(Metadata); var importer = new WsdlImporter(metadataSet); AddStateForDataContractSerializerImport(importer); AddStateForXmlSerializerImport(importer); AddStateForFaultSerializerImport(importer); AddStateForWrappedOptions(importer); Bindings = importer.ImportAllBindings(); ContractDescriptions = importer.ImportAllContracts(); Endpoints = importer.ImportAllEndpoints(); MetadataImportWarnings = importer.Errors; ConfigureEndpoints(Endpoints); bool success = true; if (MetadataImportWarnings != null) { foreach (var error in MetadataImportWarnings) { if (!error.IsWarning) { success = false; break; } } } if (!success) { var exception = new DynamicProxyException(DynamicErrorMessages.ImportError); exception.MetadataImportErrors = MetadataImportWarnings; throw exception; } }