0
|
1 using BLToolkit.TypeBuilder;
|
|
2
|
|
3 namespace Demo.WebServices.Client.WebClient
|
|
4 {
|
|
5 [System.Diagnostics.DebuggerStepThrough]
|
|
6 [System.ComponentModel.DesignerCategory("Code")]
|
|
7 public abstract class WebClientBase<T> : WebClientBase where T : WebClientBase /*<T> commented due to csc.exe bug */
|
|
8 {
|
|
9 /// <summary>
|
|
10 /// Initializes a new instance of the <see cref="WebClientBase"/> class
|
|
11 /// using the namespace from WebServiceBinding attribute as url.
|
|
12 /// </summary>
|
|
13 protected WebClientBase()
|
|
14 {
|
|
15 }
|
|
16
|
|
17 /// <summary>
|
|
18 /// Initializes a new instance of the <see cref="WebClientBase"/> class.
|
|
19 /// </summary>
|
|
20 /// <param name="relativeUrl">Path to web service, relative to <see cref="WebClientBase.BaseUrl"/>.</param>
|
|
21 protected WebClientBase(string relativeUrl) : base(relativeUrl)
|
|
22 {
|
|
23 }
|
|
24
|
|
25 /// <summary>
|
|
26 /// Cached client instance.
|
|
27 /// </summary>
|
|
28 private static T _instance;
|
|
29 public static T Instance
|
|
30 {
|
|
31 get { return _instance ?? (_instance = CreateInstance()); }
|
|
32 }
|
|
33
|
|
34 protected static T CreateInstance()
|
|
35 {
|
|
36 return TypeFactory.CreateInstance<T>();
|
|
37 }
|
|
38 }
|
|
39 } |