0
|
1 using System;
|
|
2 using System.Collections;
|
|
3 using System.Collections.Generic;
|
|
4 using System.Linq;
|
|
5 using BLToolkit.Data;
|
|
6
|
|
7 namespace BLToolkit.DataAccess
|
|
8 {
|
|
9 public class FullSqlQueryT<T> : FullSqlQuery, ISqlQueryT<T>
|
|
10 {
|
|
11 #region Constructors
|
|
12
|
|
13 public FullSqlQueryT(DbManager dbManager, bool ignoreLazyLoad = false)
|
|
14 : base(dbManager, ignoreLazyLoad)
|
|
15 {
|
|
16 }
|
|
17
|
|
18 #endregion
|
|
19
|
|
20 #region Implementation of ISqlQueryT<T>
|
|
21
|
|
22 public T SelectByKey(DbManager db, params object[] keys)
|
|
23 {
|
|
24 return (T) base.SelectByKey(db, typeof(T), keys);
|
|
25 }
|
|
26
|
|
27 public T SelectByKey(params object[] keys)
|
|
28 {
|
|
29 return (T)base.SelectByKey(typeof(T), keys);
|
|
30 }
|
|
31
|
|
32 public List<T> SelectAll(DbManager db)
|
|
33 {
|
|
34 return base.SelectAll(db, typeof(T)).Cast<T>().ToList();
|
|
35 }
|
|
36
|
|
37 public TL SelectAll<TL>(DbManager db, TL list) where TL : IList<T>
|
|
38 {
|
|
39 return (TL)base.SelectAll(db, (IList)list, typeof(T));
|
|
40 }
|
|
41
|
|
42 public TL SelectAll<TL>(DbManager db) where TL : IList<T>, new()
|
|
43 {
|
|
44 return SelectAll(db, new TL());
|
|
45 }
|
|
46
|
|
47 public List<T> SelectAll()
|
|
48 {
|
|
49 return base.SelectAll(typeof(T)).Cast<T>().ToList();
|
|
50 }
|
|
51
|
|
52 public TL SelectAll<TL>(TL list) where TL : IList<T>
|
|
53 {
|
|
54 return SelectAll(DbManager, list);
|
|
55 }
|
|
56
|
|
57 public TL SelectAll<TL>() where TL : IList<T>, new()
|
|
58 {
|
|
59 return SelectAll<TL>(DbManager);
|
|
60 }
|
|
61
|
|
62 public int Insert(DbManager db, T obj)
|
|
63 {
|
|
64 return base.Insert(db, obj);
|
|
65 }
|
|
66
|
|
67 public int Insert(T obj)
|
|
68 {
|
|
69 return base.Insert(obj);
|
|
70 }
|
|
71
|
|
72 public int Insert(DbManager db, int maxBatchSize, IEnumerable<T> list)
|
|
73 {
|
|
74 throw new NotImplementedException();
|
|
75 }
|
|
76
|
|
77 public int Insert(int maxBatchSize, IEnumerable<T> list)
|
|
78 {
|
|
79 return Insert(DbManager, maxBatchSize, list);
|
|
80 }
|
|
81
|
|
82 public int Insert(DbManager db, IEnumerable<T> list)
|
|
83 {
|
|
84 return Insert(db, int.MaxValue, list);
|
|
85 }
|
|
86
|
|
87 public int Insert(IEnumerable<T> list)
|
|
88 {
|
|
89 return Insert(DbManager, list);
|
|
90 }
|
|
91
|
|
92 public int Update(DbManager db, T obj)
|
|
93 {
|
|
94 return base.Update(db, obj);
|
|
95 }
|
|
96
|
|
97 public int Update(T obj)
|
|
98 {
|
|
99 return base.Update(obj);
|
|
100 }
|
|
101
|
|
102 public int Update(DbManager db, int maxBatchSize, IEnumerable<T> list)
|
|
103 {
|
|
104 throw new NotImplementedException();
|
|
105 }
|
|
106
|
|
107 public int Update(int maxBatchSize, IEnumerable<T> list)
|
|
108 {
|
|
109 return Update(DbManager, maxBatchSize, list);
|
|
110 }
|
|
111
|
|
112 public int Update(DbManager db, IEnumerable<T> list)
|
|
113 {
|
|
114 return Update(db, int.MaxValue, list);
|
|
115 }
|
|
116
|
|
117 public int Update(IEnumerable<T> list)
|
|
118 {
|
|
119 return Update(DbManager, list);
|
|
120 }
|
|
121
|
|
122 public int DeleteByKey(DbManager db, params object[] key)
|
|
123 {
|
|
124 return base.DeleteByKey(db, typeof(T), key);
|
|
125 }
|
|
126
|
|
127 public int DeleteByKey(params object[] key)
|
|
128 {
|
|
129 return base.DeleteByKey(typeof(T), key);
|
|
130 }
|
|
131
|
|
132 public int Delete(DbManager db, T obj)
|
|
133 {
|
|
134 return base.Delete(db, obj);
|
|
135 }
|
|
136
|
|
137 public int Delete(T obj)
|
|
138 {
|
|
139 return base.Delete(obj);
|
|
140 }
|
|
141
|
|
142 public int Delete(DbManager db, int maxBatchSize, IEnumerable<T> list)
|
|
143 {
|
|
144 throw new NotImplementedException();
|
|
145 }
|
|
146
|
|
147 public int Delete(int maxBatchSize, IEnumerable<T> list)
|
|
148 {
|
|
149 return Delete(DbManager, maxBatchSize, list);
|
|
150 }
|
|
151
|
|
152 public int Delete(DbManager db, IEnumerable<T> list)
|
|
153 {
|
|
154 return Delete(int.MaxValue, list);
|
|
155 }
|
|
156
|
|
157 public int Delete(IEnumerable<T> list)
|
|
158 {
|
|
159 return Delete(DbManager, list);
|
|
160 }
|
|
161
|
|
162 #endregion
|
|
163 }
|
|
164 } |