0
|
1 using System;
|
|
2 using System.ServiceModel;
|
|
3 using System.ServiceModel.Channels;
|
|
4
|
|
5 namespace BLToolkit.ServiceModel
|
|
6 {
|
|
7 class LinqSoapServiceClient : ClientBase<ILinqSoapService>, ILinqService, IDisposable
|
|
8 {
|
|
9 #region Init
|
|
10
|
|
11 public LinqSoapServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { }
|
|
12 public LinqSoapServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { }
|
|
13 public LinqSoapServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { }
|
|
14 public LinqSoapServiceClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { }
|
|
15
|
|
16 #endregion
|
|
17
|
|
18 #region ILinqService Members
|
|
19
|
|
20 public string GetSqlProviderType()
|
|
21 {
|
|
22 return Channel.GetSqlProviderType();
|
|
23 }
|
|
24
|
|
25 public int ExecuteNonQuery(string queryData)
|
|
26 {
|
|
27 return Channel.ExecuteNonQuery(queryData);
|
|
28 }
|
|
29
|
|
30 public object ExecuteScalar(string queryData)
|
|
31 {
|
|
32 return Channel.ExecuteScalar(queryData);
|
|
33 }
|
|
34
|
|
35 public string ExecuteReader(string queryData)
|
|
36 {
|
|
37 return Channel.ExecuteReader(queryData);
|
|
38 }
|
|
39
|
|
40 public int ExecuteBatch(string queryData)
|
|
41 {
|
|
42 return Channel.ExecuteBatch(queryData);
|
|
43 }
|
|
44
|
|
45 #endregion
|
|
46
|
|
47 #region IDisposable Members
|
|
48
|
|
49 void IDisposable.Dispose()
|
|
50 {
|
|
51 try
|
|
52 {
|
|
53 if (State != CommunicationState.Faulted)
|
|
54 ((ICommunicationObject)this).Close();
|
|
55 else
|
|
56 Abort();
|
|
57 }
|
|
58 catch (CommunicationException)
|
|
59 {
|
|
60 Abort();
|
|
61 }
|
|
62 catch (TimeoutException)
|
|
63 {
|
|
64 Abort();
|
|
65 }
|
|
66 catch (Exception)
|
|
67 {
|
|
68 Abort();
|
|
69 throw;
|
|
70 }
|
|
71 }
|
|
72
|
|
73 #endregion
|
|
74 }
|
|
75 }
|