Mercurial > pub > bltoolkit
diff Source/ServiceModel/LinqServiceClient.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Source/ServiceModel/LinqServiceClient.cs Thu Mar 27 21:46:09 2014 +0400 @@ -0,0 +1,81 @@ +using System; +using System.ServiceModel; +using System.ServiceModel.Channels; + +namespace BLToolkit.ServiceModel +{ + class LinqServiceClient : ClientBase<ILinqService>, ILinqService, IDisposable + { + #region Init + + //public LinqServiceClient() {} + public LinqServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { } + public LinqServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { } + public LinqServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { } + public LinqServiceClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { } + //public LinqServiceClient(InstanceContext callbackInstance) : base(callbackInstance) { } + //public LinqServiceClient(InstanceContext callbackInstance, string endpointConfigurationName) : base(callbackInstance, endpointConfigurationName) { } + //public LinqServiceClient(InstanceContext callbackInstance, string endpointConfigurationName, string remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } + //public LinqServiceClient(InstanceContext callbackInstance, string endpointConfigurationName, EndpointAddress remoteAddress) : base(callbackInstance, endpointConfigurationName, remoteAddress) { } + //public LinqServiceClient(InstanceContext callbackInstance, Binding binding, EndpointAddress remoteAddress) : base(callbackInstance, binding, remoteAddress) { } + + #endregion + + #region ILinqService Members + + public string GetSqlProviderType() + { + return Channel.GetSqlProviderType(); + } + + public int ExecuteNonQuery(string queryData) + { + return Channel.ExecuteNonQuery(queryData); + } + + public object ExecuteScalar(string queryData) + { + return Channel.ExecuteScalar(queryData); + } + + public string ExecuteReader(string queryData) + { + return Channel.ExecuteReader(queryData); + } + + public int ExecuteBatch(string queryData) + { + return Channel.ExecuteBatch(queryData); + } + + #endregion + + #region IDisposable Members + + void IDisposable.Dispose() + { + try + { + if (State != CommunicationState.Faulted) + ((ICommunicationObject)this).Close(); + else + Abort(); + } + catch (CommunicationException) + { + Abort(); + } + catch (TimeoutException) + { + Abort(); + } + catch (Exception) + { + Abort(); + throw; + } + } + + #endregion + } +}