diff options
Diffstat (limited to 'mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs')
-rw-r--r-- | mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs index 519e3c4fd74..e0dce888d22 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MetadataExchangeClient.cs @@ -46,21 +46,20 @@ using SMMessage = System.ServiceModel.Channels.Message; namespace System.ServiceModel.Description { - [MonoTODO] + [MonoTODO ("MetadataExchangeClientMode is not considered")] public class MetadataExchangeClient { string scheme; EndpointAddress address; SMBinding binding; + MetadataExchangeClientMode mode = MetadataExchangeClientMode.MetadataExchange; + // constructors + + [MonoTODO ("use empty configuration")] public MetadataExchangeClient () { - //FIXME: Look for config element, implementing - // IMetadataExchange contract - // Use Channel<IMetadataExchange> .. ? - - throw new NotImplementedException (); } public MetadataExchangeClient (SMBinding mexBinding) @@ -81,8 +80,11 @@ namespace System.ServiceModel.Description public MetadataExchangeClient (Uri address, MetadataExchangeClientMode mode) { this.address = new EndpointAddress (address.AbsoluteUri); + this.mode = mode; } + // sync methods + public MetadataSet GetMetadata () { return GetMetadata (address); @@ -91,7 +93,7 @@ namespace System.ServiceModel.Description public MetadataSet GetMetadata (EndpointAddress address) { //FIXME: default mode? - return GetMetadataInternal (address, MetadataExchangeClientMode.MetadataExchange); + return GetMetadataInternal (address, mode); } public MetadataSet GetMetadata (Uri address, MetadataExchangeClientMode mode) @@ -99,7 +101,7 @@ namespace System.ServiceModel.Description return GetMetadataInternal (new EndpointAddress (address.AbsoluteUri), mode); } - MetadataSet GetMetadataInternal (EndpointAddress address, MetadataExchangeClientMode mode) + internal MetadataSet GetMetadataInternal (EndpointAddress address, MetadataExchangeClientMode mode) { if (binding == null) binding = MetadataExchangeBindings.CreateMexHttpBinding (); @@ -127,6 +129,44 @@ namespace System.ServiceModel.Description return MetadataSet.ReadFrom (ret.GetReaderAtBodyContents ()); } + + // async methods + + Func<Func<MetadataSet>,MetadataSet> getter; + + void PrepareGetter () + { + if (getter == null) + getter = new Func<Func<MetadataSet>,MetadataSet> (GetMetadata); + } + + public MetadataSet EndGetMetadata (IAsyncResult result) + { + return getter.EndInvoke (result); + } + + MetadataSet GetMetadata (Func<MetadataSet> func) + { + return func (); + } + + public IAsyncResult BeginGetMetadata (AsyncCallback callback, object asyncState) + { + PrepareGetter (); + return getter.BeginInvoke (() => GetMetadata (), callback, asyncState); + } + + public IAsyncResult BeginGetMetadata (EndpointAddress address, AsyncCallback callback, object asyncState) + { + PrepareGetter (); + return getter.BeginInvoke (() => GetMetadata (address), callback, asyncState); + } + + public IAsyncResult BeginGetMetadata (Uri address, MetadataExchangeClientMode mode, AsyncCallback callback, object asyncState) + { + PrepareGetter (); + return getter.BeginInvoke (() => GetMetadata (address, mode), callback, asyncState); + } } internal class MetadataProxy : ClientBase<IMetadataExchange>, IMetadataExchange |