本文整理汇总了C#中System.ServiceModel.Description.WsdlImporter.ImportAllContracts方法的典型用法代码示例。如果您正苦于以下问题:C# WsdlImporter.ImportAllContracts方法的具体用法?C# WsdlImporter.ImportAllContracts怎么用?C# WsdlImporter.ImportAllContracts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Description.WsdlImporter
的用法示例。
在下文中一共展示了WsdlImporter.ImportAllContracts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
static void Generate(string url, TextWriter writer)
{
var cr = new ContractReference();
cr.Url = url;
var protocol = new DiscoveryClientProtocol();
var wc = new WebClient();
using (var stream = wc.OpenRead(cr.Url))
protocol.Documents.Add(cr.Url, cr.ReadDocument(stream));
var mset = ToMetadataSet(protocol);
var importer = new WsdlImporter(mset);
var xsdImporter = new XsdDataContractImporter();
var options = new ImportOptions();
options.ReferencedCollectionTypes.Add(typeof(LinkedList<>));
xsdImporter.Options = options;
importer.State.Add(typeof(XsdDataContractImporter), xsdImporter);
Collection<ContractDescription> contracts = importer.ImportAllContracts();
CodeCompileUnit ccu = new CodeCompileUnit();
CodeNamespace cns = new CodeNamespace("TestNamespace");
ccu.Namespaces.Add(cns);
var generator = new ServiceContractGenerator(ccu);
foreach (var cd in contracts)
generator.GenerateServiceContractType(cd);
var provider = new CSharpCodeProvider();
provider.GenerateCodeFromCompileUnit(ccu, writer, null);
}
示例2: GenerateVBCodeForService
static void GenerateVBCodeForService(Uri metadataAddress, string outputFile)
{
MetadataExchangeClient mexClient = new MetadataExchangeClient(metadataAddress, MetadataExchangeClientMode.HttpGet);
mexClient.ResolveMetadataReferences = true;
MetadataSet metaDocs = mexClient.GetMetadata();
WsdlImporter importer = new WsdlImporter(metaDocs);
ServiceContractGenerator generator = new ServiceContractGenerator();
System.Collections.ObjectModel.Collection<ContractDescription> contracts = importer.ImportAllContracts();
foreach (ContractDescription contract in contracts)
{
generator.GenerateServiceContractType(contract);
}
if (generator.Errors.Count != 0)
throw new ApplicationException("There were errors during code compilation.");
// Write the code dom.
System.CodeDom.Compiler.CodeGeneratorOptions options = new System.CodeDom.Compiler.CodeGeneratorOptions();
options.BracingStyle = "C";
System.CodeDom.Compiler.CodeDomProvider codeDomProvider = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("VB");
System.CodeDom.Compiler.IndentedTextWriter textWriter = new System.CodeDom.Compiler.IndentedTextWriter(new System.IO.StreamWriter(outputFile));
codeDomProvider.GenerateCodeFromCompileUnit(generator.TargetCompileUnit, textWriter, options);
textWriter.Close();
}
示例3: GenerateCodeDomTree
private static void GenerateCodeDomTree(WsdlImporter wsdlImporter, ServiceContractGenerator contractGenerator)
{
Collection<ContractDescription> contracts = wsdlImporter.ImportAllContracts();
Collection<Binding> bindings = wsdlImporter.ImportAllBindings();
ServiceEndpointCollection endpoints = wsdlImporter.ImportAllEndpoints();
if (wsdlImporter.Errors.Any(e => !e.IsWarning))
{
throw new CodeGenerationException(wsdlImporter.Errors);
}
foreach (ContractDescription contract in contracts)
{
//TODO:Alex:Make the naming scheme customisable.
contract.Name = "I" + contract.Name.Replace("Interface", string.Empty);
contractGenerator.GenerateServiceContractType(contract);
}
foreach (Binding binding in bindings)
{
string bindingSectionName, configurationName;
contractGenerator.GenerateBinding(binding, out bindingSectionName, out configurationName);
}
foreach (ServiceEndpoint endpoint in endpoints)
{
ChannelEndpointElement channelElement;
contractGenerator.GenerateServiceEndpoint(endpoint, out channelElement);
}
}
示例4: ImportMetadata
public ServiceMetadataInformation ImportMetadata(Collection<MetadataSection> metadataCollection, MetadataImporterSerializerFormatMode formatMode)
{
CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
CodeDomProvider codeDomProvider = m_CodeDomProviderFactory.CreateProvider();
WsdlImporter importer = new WsdlImporter(new MetadataSet(metadataCollection));
switch (formatMode)
{
case MetadataImporterSerializerFormatMode.DataContractSerializer:
AddStateForDataContractSerializerImport(importer, formatMode, codeCompileUnit, codeDomProvider);
break;
case MetadataImporterSerializerFormatMode.XmlSerializer:
AddStateForXmlSerializerImport(importer, codeCompileUnit, codeDomProvider);
break;
case MetadataImporterSerializerFormatMode.Auto:
AddStateForDataContractSerializerImport(importer, formatMode, codeCompileUnit, codeDomProvider);
AddStateForXmlSerializerImport(importer, codeCompileUnit, codeDomProvider);
break;
}
if (!importer.State.ContainsKey(typeof(WrappedOptions)))
{
importer.State.Add(typeof(WrappedOptions), new WrappedOptions
{
WrappedFlag = false
});
}
Collection<Binding> bindings = importer.ImportAllBindings();
Collection<ContractDescription> contracts = importer.ImportAllContracts();
ServiceEndpointCollection endpoints = importer.ImportAllEndpoints();
Collection<MetadataConversionError> importErrors = importer.Errors;
bool success = true;
if (importErrors != null)
{
foreach (MetadataConversionError error in importErrors)
{
if (!error.IsWarning)
{
success = false;
break;
}
}
}
if (!success)
{
//TODO: Throw exception
}
return new ServiceMetadataInformation(codeCompileUnit, codeDomProvider)
{
Bindings = bindings,
Contracts = contracts,
Endpoints = endpoints
};
}
示例5: GenerateCodeFromImportedContracts
public CodeCompileUnit GenerateCodeFromImportedContracts(WsdlImporter importer)
{
var generator = new ServiceContractGenerator();
var contracts = importer.ImportAllContracts();
foreach (var contract in contracts)
{
generator.GenerateServiceContractType(contract);
}
if (generator.Errors.Count != 0)
throw new Exception("There were errors during code compilation.");
var targetCompileUnit = generator.TargetCompileUnit;
return targetCompileUnit;
}
示例6: WebService
public WebService(string path)
{
var metadataAddress = new EndpointAddress(path);
var mexClient = new MetadataExchangeClient(metadataAddress.Uri, MetadataExchangeClientMode.HttpGet);
mexClient.ResolveMetadataReferences = true;
var metadata = mexClient.GetMetadata(metadataAddress.Uri, MetadataExchangeClientMode.HttpGet);
var metadataSet = new MetadataSet(metadata.MetadataSections);
var importer = new WsdlImporter(metadataSet);
AllWsdlDocuments = importer.WsdlDocuments;
AllContracts = importer.ImportAllContracts();
AllBindings = importer.ImportAllBindings();
AllEndpoints = importer.ImportAllEndpoints();
//AllContracts.First().Operations.First().
}
示例7: Import
public static CodeCompileUnit Import (MetadataSet metadata, ImportOptions options)
{
var importer = new WsdlImporter (metadata);
var xsdImporter = new XsdDataContractImporter ();
xsdImporter.Options = options;
importer.State.Add (typeof(XsdDataContractImporter), xsdImporter);
var contracts = importer.ImportAllContracts ();
CodeCompileUnit ccu = new CodeCompileUnit ();
var generator = new ServiceContractGenerator (ccu);
if (contracts.Count != 1)
throw new InvalidOperationException (string.Format (
"Metadata import failed: found {0} contracts.", contracts.Count));
var contract = contracts.First ();
generator.GenerateServiceContractType (contract);
return ccu;
}
示例8: ImportMetadata
private void ImportMetadata(WsdlImporter wsdlImporter,
out ServiceEndpointCollection endpoints,
out Collection<System.ServiceModel.Channels.Binding> bindings,
out Collection<ContractDescription> contracts)
{
endpoints = wsdlImporter.ImportAllEndpoints();
bindings = wsdlImporter.ImportAllBindings();
contracts = wsdlImporter.ImportAllContracts();
ThrowOnMetadataConversionErrors(wsdlImporter.Errors);
}
示例9: Run
void Run (string [] args)
{
co.ProcessArgs (args);
if (co.RemainingArguments.Length == 0) {
co.DoHelp ();
return;
}
if (!co.NoLogo)
co.ShowBanner ();
CodeCompileUnit ccu = new CodeCompileUnit ();
CodeNamespace cns = new CodeNamespace (co.Namespace);
ccu.Namespaces.Add (cns);
generator = new ServiceContractGenerator (ccu);
generator.Options = GetGenerationOption ();
generator.Options |=ServiceContractGenerationOptions.ChannelInterface;
code_provider = GetCodeProvider ();
MetadataSet metadata = null;
// For now only assemblyPath is supported.
foreach (string arg in co.RemainingArguments) {
Uri uri = null;
if (Uri.TryCreate (arg, UriKind.Absolute, out uri)) {
metadata = ResolveWithDisco (arg);
if (metadata == null)
metadata = ResolveWithWSMex (arg);
continue;
}
FileInfo fi = new FileInfo (arg);
if (!fi.Exists)
switch (fi.Extension) {
case ".exe":
case ".dll":
GenerateContractType (fi.FullName);
break;
default:
throw new NotSupportedException ("Not supported file extension: " + fi.Extension);
}
}
if (metadata == null)
return;
List<IWsdlImportExtension> list = new List<IWsdlImportExtension> ();
list.Add (new TransportBindingElementImporter ());
//list.Add (new DataContractSerializerMessageContractImporter ());
list.Add (new XmlSerializerMessageContractImporter ());
//WsdlImporter importer = new WsdlImporter (metadata, null, list);
WsdlImporter importer = new WsdlImporter (metadata);
//ServiceEndpointCollection endpoints = importer.ImportAllEndpoints ();
Console.WriteLine ("Generating files..");
/*foreach (ServiceEndpoint se in endpoints)
generator.GenerateServiceContractType (se.Contract);*/
Collection<ContractDescription> contracts = importer.ImportAllContracts ();
foreach (ContractDescription cd in contracts)
generator.GenerateServiceContractType (cd);
/*if (cns.Types.Count == 0) {
Console.Error.WriteLine ("Argument assemblies have no types.");
Environment.Exit (1);
}*/
//FIXME: Generate .config
Console.WriteLine (GetOutputFilename ());
using (TextWriter w = File.CreateText (GetOutputFilename ())) {
code_provider.GenerateCodeFromCompileUnit (ccu, w, null);
}
}
示例10: GenerateVBCodeForService
static void GenerateVBCodeForService(EndpointAddress metadataAddress, string outputFile)
{
MetadataExchangeClient mexClient = new MetadataExchangeClient(metadataAddress);
mexClient.ResolveMetadataReferences = true;
MetadataSet metaDocs = mexClient.GetMetadata();
WsdlImporter importer = new WsdlImporter(metaDocs);
ServiceContractGenerator generator = new ServiceContractGenerator();
// Uncomment the following code if you are going to do your work programmatically rather than add
// the WsdlDocumentationImporters through a configuration file.
/*
// The following code inserts the custom WSDL programmatically adding the custom WsdlImporter without
// removing the other importers already in the collection.
System.Collections.Generic.IEnumerable<IWsdlImportExtension> exts = importer.WsdlExtensions;
System.Collections.Generic.List<IWsdlImportExtension> newExts = new System.Collections.Generic.List<IWsdlImportExtension>();
foreach (IWsdlImportExtension ext in exts)
newExts.Add(ext);
newExts.Add(new WsdlDocumentationImporter());
importer = new WsdlImporter(newExts.ToArray(), metaDocs.MetadataSections);
*/
System.Collections.ObjectModel.Collection<ContractDescription> contracts = importer.ImportAllContracts();
foreach (ContractDescription contract in contracts)
{
generator.GenerateServiceContractType(contract);
}
if (generator.Errors.Count != 0)
throw new ApplicationException("There were errors during code compilation.");
// Write the code dom.
System.CodeDom.Compiler.CodeGeneratorOptions options = new System.CodeDom.Compiler.CodeGeneratorOptions();
options.BracingStyle = "C";
System.CodeDom.Compiler.CodeDomProvider codeDomProvider = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("VB");
System.CodeDom.Compiler.IndentedTextWriter textWriter = new System.CodeDom.Compiler.IndentedTextWriter(new System.IO.StreamWriter(outputFile));
codeDomProvider.GenerateCodeFromCompileUnit(generator.TargetCompileUnit, textWriter, options);
textWriter.Close();
}
示例11: ImportMetadata
private void ImportMetadata()
{
this.codeCompileUnit = new CodeCompileUnit();
CreateCodeDomProvider();
WsdlImporter importer = new WsdlImporter(new MetadataSet(metadataCollection));
AddStateForDataContractSerializerImport(importer);
AddStateForXmlSerializerImport(importer);
this.bindings = importer.ImportAllBindings();
this.contracts = importer.ImportAllContracts();
this.endpoints = importer.ImportAllEndpoints();
this.importWarnings = importer.Errors;
bool success = true;
if (this.importWarnings != null)
{
foreach (MetadataConversionError error in this.importWarnings)
{
if (!error.IsWarning)
{
success = false;
break;
}
}
}
if (!success)
{
DynamicProxyException exception = new DynamicProxyException(
Constants.ErrorMessages.ImportError);
exception.MetadataImportErrors = this.importWarnings;
throw exception;
}
}
示例12: CreateProxyFile
protected override string CreateProxyFile (DotNetProject dotNetProject, FilePath basePath, string proxyNamespace, string referenceName)
{
CodeCompileUnit ccu = new CodeCompileUnit ();
CodeNamespace cns = new CodeNamespace (proxyNamespace);
ccu.Namespaces.Add (cns);
bool targetMoonlight = dotNetProject.TargetFramework.Id.StartsWith ("SL");
bool targetMonoTouch = dotNetProject.TargetFramework.Id.StartsWith ("IPhone");
ServiceContractGenerator generator = new ServiceContractGenerator (ccu);
generator.Options = ServiceContractGenerationOptions.ChannelInterface | ServiceContractGenerationOptions.ClientClass;
if (refGroup.ClientOptions.GenerateAsynchronousMethods)
generator.Options |= ServiceContractGenerationOptions.AsynchronousMethods;
if (refGroup.ClientOptions.GenerateInternalTypes)
generator.Options |= ServiceContractGenerationOptions.InternalTypes;
if (refGroup.ClientOptions.GenerateMessageContracts)
generator.Options |= ServiceContractGenerationOptions.TypedMessages;
// if (targetMoonlight || targetMonoTouch)
// generator.Options |= ServiceContractGenerationOptions.EventBasedAsynchronousMethods;
MetadataSet mset;
if (protocol != null)
mset = ToMetadataSet (protocol);
else
mset = metadata;
CodeDomProvider code_provider = GetProvider (dotNetProject);
List<IWsdlImportExtension> list = new List<IWsdlImportExtension> ();
list.Add (new TransportBindingElementImporter ());
list.Add (new XmlSerializerMessageContractImporter ());
WsdlImporter importer = new WsdlImporter (mset);
Collection<ContractDescription> contracts = importer.ImportAllContracts ();
foreach (ContractDescription cd in contracts) {
cd.Namespace = proxyNamespace;
if (targetMoonlight || targetMonoTouch) {
var moonctx = new MoonlightChannelBaseContext ();
cd.Behaviors.Add (new MoonlightChannelBaseContractExtension (moonctx, targetMonoTouch));
foreach (var od in cd.Operations)
od.Behaviors.Add (new MoonlightChannelBaseOperationExtension (moonctx, targetMonoTouch));
generator.GenerateServiceContractType (cd);
moonctx.Fixup ();
}
else
generator.GenerateServiceContractType (cd);
}
string fileSpec = Path.Combine (basePath, referenceName + "." + code_provider.FileExtension);
using (TextWriter w = File.CreateText (fileSpec)) {
code_provider.GenerateCodeFromCompileUnit (ccu, w, null);
}
return fileSpec;
}
示例13: GenerateCSCodeForService
// Code to generate the proxy
public static string GenerateCSCodeForService(string gennamespace, EndpointAddress metadataAddress)
{
var mexClient = new MetadataExchangeClient(metadataAddress.Uri, MetadataExchangeClientMode.HttpGet);
mexClient.ResolveMetadataReferences = true;
var metadata = mexClient.GetMetadata(metadataAddress.Uri, MetadataExchangeClientMode.HttpGet);
var metadataSet = new MetadataSet(metadata.MetadataSections);
var importer = new WsdlImporter(metadataSet);
var importAllContracts = importer.ImportAllContracts();
var codeDomProvider = CodeDomProvider.CreateProvider("CSharp");
var output = new StringWriter();
return string.Empty;
//importer.ImportAllBindings()
//return codeDomExperiment(gennamespace, codeDomProvider, output, importAllContracts);
// var generator = new ServiceContractGenerator();
// generator.Options = ServiceContractGenerationOptions.TypedMessages
// //| ServiceContractGenerationOptions.AsynchronousMethods
// //| ServiceContractGenerationOptions.ClientClass
// //| ServiceContractGenerationOptions.EventBasedAsynchronousMethods
// //| ServiceContractGenerationOptions.InternalTypes
// ;
// // This line enables a namespace wrapping all classes
// generator.NamespaceMappings.Add("*", gennamespace);
// //generator.NamespaceMappings.Add("?", gennamespace); // Contract descript namespace?
// importer.State.Remove(typeof (XsdDataContractExporter)); // This doesn't do anything in the sample
//
// var importer2 = new XsdDataContractImporter();
// var options2 = new ImportOptions();
// options2.EnableDataBinding = true; // HERE we implement INotifyPropertyChanged
// options2.GenerateInternal = false; // Control if class is internal
// importer2.Options = options2;
// importer2.Options.Namespaces.Add("*", gennamespace);
// // Not used in sample but presumably allows array types to be mapped to a specific ienumerable<>
// importer2.Options.ReferencedCollectionTypes.Add(typeof (ObservableCollection<>));
//
// // Here we override the default importer with our own,
// importer.State.Add(typeof (XsdDataContractImporter), importer2);
//
//
// Collection<ContractDescription> collection = importer.ImportAllContracts();
// importer.ImportAllEndpoints();
// foreach (ContractDescription description in collection)
// {
// generator.GenerateServiceContractType(description);
// }
// if (generator.Errors.Count != 0)
// {
// generator.Errors.ToList().ForEach(
// mce => Console.WriteLine("{0}: {1}", mce.IsWarning ? "Warning" : "Error", mce.Message));
// throw new Exception("There were errors during code compilation.");
// }
// //new WcfSilverlightCodeGenerationExtension().ClientGenerated(generator);
// var options = new CodeGeneratorOptions();
//
// var provider = CodeDomProvider.CreateProvider("C#");
//
// var sb = new StringBuilder();
// var sw = new StringWriter(sb);
//
// using (var writer = new IndentedTextWriter(sw))
// {
// provider.GenerateCodeFromCompileUnit(generator.TargetCompileUnit, writer, options);
// }
//
// return sb.ToString();
}
示例14: AppDMoviesWSAutoDiscovery
public AppDMoviesWSAutoDiscovery(string webserviceBindingUri, string interfaceContractName)
{
// Define the metadata address, contract name, operation name, and parameters.
// You can choose between MEX endpoint and HTTP GET by changing the address and enum value.
Uri mexAddress = new Uri(webserviceBindingUri);
// For MEX endpoints use a MEX address and a mexMode of .MetadataExchange
MetadataExchangeClientMode mexMode = MetadataExchangeClientMode.HttpGet;
string contractName = interfaceContractName;
//string creditcard, string expiry, string cvv
// Get the metadata file from the service.
MetadataExchangeClient mexClient = new MetadataExchangeClient(mexAddress, mexMode);
mexClient.ResolveMetadataReferences = true;
MetadataSet metaSet = mexClient.GetMetadata();
// Import all contracts and endpoints
WsdlImporter importer = new WsdlImporter(metaSet);
Collection<ContractDescription> contracts = importer.ImportAllContracts();
ServiceEndpointCollection allEndpoints = importer.ImportAllEndpoints();
// Generate type information for each contract
ServiceContractGenerator generator = new ServiceContractGenerator();
var endpointsForContracts = new Dictionary<string, IEnumerable<ServiceEndpoint>>();
foreach (ContractDescription contract in contracts)
{
generator.GenerateServiceContractType(contract);
// Keep a list of each contract's endpoints
endpointsForContracts[contract.Name] = allEndpoints.Where(
se => se.Contract.Name == contract.Name).ToList();
}
if (generator.Errors.Count != 0)
throw new Exception("There were errors during code compilation.");
// Generate a code file for the contracts
CodeGeneratorOptions options = new CodeGeneratorOptions();
options.BracingStyle = "C";
CodeDomProvider codeDomProvider = CodeDomProvider.CreateProvider("C#");
// Compile the code file to an in-memory assembly
// Don't forget to add all WCF-related assemblies as references
CompilerParameters compilerParameters = new CompilerParameters(
new string[] {
"System.dll", "System.ServiceModel.dll",
"System.Runtime.Serialization.dll" });
compilerParameters.GenerateInMemory = true;
CompilerResults results = codeDomProvider.CompileAssemblyFromDom(compilerParameters, generator.TargetCompileUnit);
if (results.Errors.Count > 0)
{
throw new Exception("There were errors during generated code compilation");
}
else
{
// Find the proxy type that was generated for the specified contract
// (identified by a class that implements the contract and ICommunicationObject)
Type[] mytypes = results.CompiledAssembly.GetTypes();
Type clientProxyType = mytypes.First(
t => t.IsClass &&
t.GetInterface(contractName) != null &&
t.GetInterface(typeof(ICommunicationObject).Name) != null);
// Get the first service endpoint for the contract
ServiceEndpoint se = endpointsForContracts[contractName].First();
// Create an instance of the proxy
// Pass the endpoint's binding and address as parameters
// to the ctor
proxyinstance = results.CompiledAssembly.CreateInstance(
clientProxyType.Name,
false,
System.Reflection.BindingFlags.CreateInstance,
null,
new object[] { se.Binding, se.Address },
CultureInfo.CurrentCulture, null);
}
}
示例15: CreateProxyFile
protected override string CreateProxyFile (DotNetProject dotNetProject, FilePath basePath, string proxyNamespace, string referenceName)
{
var ccu = new CodeCompileUnit ();
var cns = new CodeNamespace (proxyNamespace);
ccu.Namespaces.Add (cns);
bool targetMoonlight = dotNetProject.TargetFramework.Id.Identifier == ("Silverlight");
bool targetMonoTouch = dotNetProject.TargetFramework.Id.Identifier == ("MonoTouch");
bool targetMonoDroid = dotNetProject.TargetFramework.Id.Identifier == ("MonoDroid");
bool targetCoreClr = targetMoonlight || targetMonoDroid || targetMonoTouch;
bool generateSyncMethods = targetMonoDroid | targetMonoTouch;
var generator = new ServiceContractGenerator (ccu);
generator.Options = ServiceContractGenerationOptions.ChannelInterface | ServiceContractGenerationOptions.ClientClass;
if (refGroup.ClientOptions.GenerateAsynchronousMethods || targetCoreClr)
generator.Options |= ServiceContractGenerationOptions.AsynchronousMethods;
if (refGroup.ClientOptions.GenerateEventBasedAsynchronousMethods)
generator.Options |= ServiceContractGenerationOptions.EventBasedAsynchronousMethods;
#if NET_4_5
if (refGroup.ClientOptions.GenerateTaskBasedAsynchronousMethod)
generator.Options |= ServiceContractGenerationOptions.TaskBasedAsynchronousMethod;
#endif
if (refGroup.ClientOptions.GenerateInternalTypes)
generator.Options |= ServiceContractGenerationOptions.InternalTypes;
if (refGroup.ClientOptions.GenerateMessageContracts)
generator.Options |= ServiceContractGenerationOptions.TypedMessages;
// if (targetMoonlight || targetMonoTouch)
// generator.Options |= ServiceContractGenerationOptions.EventBasedAsynchronousMethods;
MetadataSet mset;
mset = protocol != null ? ToMetadataSet (protocol) : metadata;
CodeDomProvider code_provider = GetProvider (dotNetProject);
var list = new List<IWsdlImportExtension> ();
list.Add (new TransportBindingElementImporter ());
list.Add (new XmlSerializerMessageContractImporter ());
var importer = new WsdlImporter (mset);
try {
ConfigureImporter (importer);
} catch {
}
Collection<ContractDescription> contracts = importer.ImportAllContracts ();
foreach (ContractDescription cd in contracts) {
cd.Namespace = proxyNamespace;
if (targetCoreClr) {
var moonctx = new MoonlightChannelBaseContext ();
cd.Behaviors.Add (new MoonlightChannelBaseContractExtension (moonctx, generateSyncMethods));
foreach (var od in cd.Operations)
od.Behaviors.Add (new MoonlightChannelBaseOperationExtension (moonctx, generateSyncMethods));
generator.GenerateServiceContractType (cd);
moonctx.Fixup ();
}
else
generator.GenerateServiceContractType (cd);
}
string fileSpec = Path.Combine (basePath, referenceName + "." + code_provider.FileExtension);
using (TextWriter w = File.CreateText (fileSpec)) {
code_provider.GenerateCodeFromCompileUnit (ccu, w, null);
}
return fileSpec;
}