Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 2684e02

Browse files
committed
Monster commit to remove access to deprecated APIs
Also removed where T : new() constraint
1 parent 0d17690 commit 2684e02

File tree

99 files changed

+5130
-5272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+5130
-5272
lines changed

lib/ServiceStack.Common.dll

1.5 KB
Binary file not shown.

lib/ServiceStack.Common.pdb

0 Bytes
Binary file not shown.

lib/ServiceStack.Interfaces.dll

512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

src/FirebirdTests/TestExpressions/Main.cs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ public static void Main (string[] args)
4949

5050
using (IDbConnection db =
5151
"User=SYSDBA;Password=masterkey;Database=employee.fdb;DataSource=localhost;Dialect=3;charset=ISO8859_1;".OpenDbConnection())
52-
using ( IDbCommand dbCmd = db.CreateCommand())
5352
{
54-
dbCmd.DropTable<Author>();
55-
dbCmd.CreateTable<Author>();
56-
dbCmd.DeleteAll<Author>();
53+
db.DropTable<Author>();
54+
db.CreateTable<Author>();
55+
db.DeleteAll<Author>();
5756

5857
List<Author> authors = new List<Author>();
5958
authors.Add(new Author(){Name="Demis Bellot",Birthday= DateTime.Today.AddYears(-20),Active=true,Earnings= 99.9m,Comments="CSharp books", Rate=10, City="London"});
@@ -71,7 +70,7 @@ public static void Main (string[] args)
7170
authors.Add(new Author(){Name="Xavi Garzon",Birthday= DateTime.Today.AddYears(-22),Active=true,Earnings= 75.0m,Comments="CSharp books", Rate=9, City="Madrid"});
7271
authors.Add(new Author(){Name="Luis garzon",Birthday= DateTime.Today.AddYears(-22),Active=true,Earnings= 85.0m,Comments="CSharp books", Rate=10, City="Mexico"});
7372

74-
dbCmd.InsertAll(authors);
73+
db.InsertAll(authors);
7574

7675

7776
// lets start !
@@ -81,20 +80,20 @@ public static void Main (string[] args)
8180
int expected=5;
8281

8382
ev.Where(rn=> rn.Birthday>=new DateTime(year, 1,1) && rn.Birthday<=new DateTime(year, 12,31));
84-
List<Author> result=dbCmd.Select(ev);
83+
List<Author> result=db.Select(ev);
8584
Console.WriteLine(ev.WhereExpression);
8685
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
87-
result = dbCmd.Select<Author>(qry => qry.Where(rn => rn.Birthday >= new DateTime(year, 1, 1) && rn.Birthday <= new DateTime(year, 12, 31)));
86+
result = db.Select<Author>(qry => qry.Where(rn => rn.Birthday >= new DateTime(year, 1, 1) && rn.Birthday <= new DateTime(year, 12, 31)));
8887
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected == result.Count);
89-
result = dbCmd.Select<Author>(rn => rn.Birthday >= new DateTime(year, 1, 1) && rn.Birthday <= new DateTime(year, 12, 31));
88+
result = db.Select<Author>(rn => rn.Birthday >= new DateTime(year, 1, 1) && rn.Birthday <= new DateTime(year, 12, 31));
9089
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected == result.Count);
9190

9291

9392
// select authors from London, Berlin and Madrid : 6
9493
expected=6;
9594
//Sql.In can take params object[]
9695
ev.Where(rn=> Sql.In( rn.City, new object[]{"London", "Madrid", "Berlin"}) );
97-
result=dbCmd.Select(ev);
96+
result=db.Select(ev);
9897
Console.WriteLine(ev.WhereExpression);
9998
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
10099

@@ -105,90 +104,90 @@ public static void Main (string[] args)
105104
cities.Add("Bogota");
106105
cities.Add("Cartagena");
107106
ev.Where(rn => Sql.In(rn.City, cities ));
108-
result=dbCmd.Select(ev);
107+
result=db.Select(ev);
109108
Console.WriteLine(ev.WhereExpression);
110109
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
111110

112111

113112
// select authors which name starts with A
114113
expected=3;
115114
ev.Where(rn=> rn.Name.StartsWith("A") );
116-
result=dbCmd.Select(ev);
115+
result=db.Select(ev);
117116
Console.WriteLine(ev.WhereExpression);
118117
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
119118

120119
// select authors which name ends with Garzon o GARZON o garzon ( no case sensitive )
121120
expected=3;
122121
ev.Where(rn=> rn.Name.ToUpper().EndsWith("GARZON") );
123-
result=dbCmd.Select(ev);
122+
result=db.Select(ev);
124123
Console.WriteLine(ev.WhereExpression);
125124
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
126125

127126
// select authors which name ends with garzon ( no case sensitive )
128127
expected=3;
129128
ev.Where(rn=> rn.Name.EndsWith("garzon") );
130-
result=dbCmd.Select(ev);
129+
result=db.Select(ev);
131130
Console.WriteLine(ev.WhereExpression);
132131
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
133132

134133

135134
// select authors which name contains Benedict
136135
expected=2;
137136
ev.Where(rn=> rn.Name.Contains("Benedict") );
138-
result=dbCmd.Select(ev);
137+
result=db.Select(ev);
139138
Console.WriteLine(ev.WhereExpression);
140139
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
141140

142141

143142
// select authors with Earnings <= 50
144143
expected=3;
145144
ev.Where(rn=> rn.Earnings<=50 );
146-
result=dbCmd.Select(ev);
145+
result=db.Select(ev);
147146
Console.WriteLine(ev.WhereExpression);
148147
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
149148

150149
// select authors with Rate = 10 and city=Mexio
151150
expected=1;
152151
ev.Where(rn=> rn.Rate==10 && rn.City=="Mexico");
153-
result=dbCmd.Select(ev);
152+
result=db.Select(ev);
154153
Console.WriteLine(ev.WhereExpression);
155154
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
156155

157156
// enough selecting, lets update;
158157
// set Active=false where rate =0
159158
expected=2;
160159
ev.Where(rn=> rn.Rate==0 ).Update(rn=> rn.Active);
161-
var rows = dbCmd.UpdateOnly( new Author(){ Active=false }, ev);
160+
var rows = db.UpdateOnly( new Author(){ Active=false }, ev);
162161
Console.WriteLine(ev.WhereExpression);
163162
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, rows, expected==rows);
164163

165164
// insert values only in Id, Name, Birthday, Rate and Active fields
166165
expected=4;
167166
ev.Insert(rn =>new { rn.Id, rn.Name, rn.Birthday, rn.Active, rn.Rate} );
168-
dbCmd.InsertOnly( new Author(){Active=false, Rate=0, Name="Victor Grozny", Birthday=DateTime.Today.AddYears(-18) }, ev);
169-
dbCmd.InsertOnly( new Author(){Active=false, Rate=0, Name="Ivan Chorny", Birthday=DateTime.Today.AddYears(-19) }, ev);
167+
db.InsertOnly( new Author(){Active=false, Rate=0, Name="Victor Grozny", Birthday=DateTime.Today.AddYears(-18) }, ev);
168+
db.InsertOnly( new Author(){Active=false, Rate=0, Name="Ivan Chorny", Birthday=DateTime.Today.AddYears(-19) }, ev);
170169
ev.Where(rn=> !rn.Active);
171-
result=dbCmd.Select(ev);
170+
result=db.Select(ev);
172171
Console.WriteLine(ev.WhereExpression);
173172
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
174173

175174
//update comment for City == null
176175
expected=2;
177176
ev.Where( rn => rn.City==null ).Update(rn=> rn.Comments);
178-
rows=dbCmd.UpdateOnly(new Author(){Comments="No comments"}, ev);
177+
rows=db.UpdateOnly(new Author(){Comments="No comments"}, ev);
179178
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, rows, expected==rows);
180179

181180
// delete where City is null
182181
expected=2;
183-
rows = dbCmd.Delete( ev);
182+
rows = db.Delete( ev);
184183
Console.WriteLine(ev.WhereExpression);
185184
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, rows, expected==rows);
186185

187186

188187
// lets select all records ordered by Rate Descending and Name Ascending
189188
expected=14;
190189
ev.Where().OrderBy(rn=> new{ at=Sql.Desc(rn.Rate), rn.Name }); // clear where condition
191-
result=dbCmd.Select(ev);
190+
result=db.Select(ev);
192191
Console.WriteLine(ev.WhereExpression);
193192
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
194193
Console.WriteLine(ev.OrderByExpression);
@@ -199,7 +198,7 @@ public static void Main (string[] args)
199198

200199
expected=5;
201200
ev.Limit(5); // note: order is the same as in the last sentence
202-
result=dbCmd.Select(ev);
201+
result=db.Select(ev);
203202
Console.WriteLine(ev.WhereExpression);
204203
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
205204

@@ -208,23 +207,23 @@ public static void Main (string[] args)
208207

209208
ev.Select(rn=> new { at= Sql.As( rn.Name.ToUpper(), "Name" ), rn.City} );
210209
Console.WriteLine(ev.SelectExpression);
211-
result=dbCmd.Select(ev);
210+
result=db.Select(ev);
212211
author = result.FirstOrDefault();
213212
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Claudia Espinel".ToUpper(), author.Name, "Claudia Espinel".ToUpper()==author.Name);
214213

215214
//paging :
216215
ev.Limit(0,4);// first page, page size=4;
217-
result=dbCmd.Select(ev);
216+
result=db.Select(ev);
218217
author = result.FirstOrDefault();
219218
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Claudia Espinel".ToUpper(), author.Name, "Claudia Espinel".ToUpper()==author.Name);
220219

221220
ev.Limit(4,4);// second page
222-
result=dbCmd.Select(ev);
221+
result=db.Select(ev);
223222
author = result.FirstOrDefault();
224223
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Jorge Garzon".ToUpper(), author.Name, "Jorge Garzon".ToUpper()==author.Name);
225224

226225
ev.Limit(8,4);// third page
227-
result=dbCmd.Select(ev);
226+
result=db.Select(ev);
228227
author = result.FirstOrDefault();
229228
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", "Rodger Contreras".ToUpper(), author.Name, "Rodger Contreras".ToUpper()==author.Name);
230229

@@ -233,7 +232,7 @@ public static void Main (string[] args)
233232
ev.Limit(); // clear limit
234233
ev.SelectDistinct(r=>r.City);
235234
expected=6;
236-
result=dbCmd.Select(ev);
235+
result=db.Select(ev);
237236
Console.WriteLine("Expected:{0} ; Selected:{1}, OK? {2}", expected, result.Count, expected==result.Count);
238237

239238

src/FirebirdTests/TestLiteFirebird00/Main.cs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,16 @@ public static void Main (string[] args)
7979

8080
using (IDbConnection db =
8181
"User=SYSDBA;Password=masterkey;Database=employee.fdb;DataSource=localhost;Dialect=3;charset=ISO8859_1;".OpenDbConnection())
82-
using ( IDbCommand dbCmd = db.CreateCommand())
8382
{
8483
//try{
8584
// due to firebirdslq features, we have to drop book first and then author
86-
dbCmd.DropTable<Book>();
87-
dbCmd.DropTable<Author>();
85+
db.DropTable<Book>();
86+
db.DropTable<Author>();
8887

89-
dbCmd.CreateTable<Author>();
90-
dbCmd.CreateTable<Book>();
88+
db.CreateTable<Author>();
89+
db.CreateTable<Book>();
9190

92-
dbCmd.Insert( new Author(){
91+
db.Insert( new Author(){
9392
Name="Demis Bellot",
9493
Birthday= DateTime.Today.AddYears(20),
9594
Active=true,
@@ -99,7 +98,7 @@ public static void Main (string[] args)
9998
Rate=10
10099
});
101100

102-
dbCmd.Insert( new Author(){
101+
db.Insert( new Author(){
103102
Name="Angel Colmenares",
104103
Birthday= DateTime.Today.AddYears(30),
105104
Active=true,
@@ -109,7 +108,7 @@ public static void Main (string[] args)
109108
Rate=9
110109
});
111110

112-
dbCmd.Insert( new Author(){
111+
db.Insert( new Author(){
113112
Name="Adam Witco",
114113
Birthday= DateTime.Today.AddYears(25),
115114
Active=true,
@@ -119,7 +118,7 @@ public static void Main (string[] args)
119118
});
120119

121120

122-
dbCmd.Insert( new Author(){
121+
db.Insert( new Author(){
123122
Name="Claudia Espinel",
124123
Birthday= DateTime.Today.AddYears(28),
125124
Active=false,
@@ -142,33 +141,33 @@ public static void Main (string[] args)
142141
Comments="this will not be inserted" // null in db
143142
};
144143

145-
dbCmd.InsertOnly(author, ev);
144+
db.InsertOnly(author, ev);
146145

147146
author.Comments="this will be updated";
148147

149148
ev.Update(rn=> rn.Comments).Where(r=>r.Id==author.Id);
150-
dbCmd.UpdateOnly(author, ev);
149+
db.UpdateOnly(author, ev);
151150

152151

153152
// update comment for all authors from london...
154153

155154
author.Comments="update from london";
156155
ev.Where(rn=> rn.City=="London");
157-
dbCmd.UpdateOnly(author, ev);
156+
db.UpdateOnly(author, ev);
158157

159158
// select author from Bogota
160159
ev.Where(rn=> rn.City=="Bogota");
161-
var authors = dbCmd.Select(ev);
160+
var authors = db.Select(ev);
162161
Console.WriteLine(authors.Count);
163162

164163
// select author from Bogota and Active=true;
165164

166165
ev.Where(rn=> rn.City=="Bogota" && rn.Active==true); // sorry for firebird must write ==true !
167-
authors = dbCmd.Select(ev);
166+
authors = db.Select(ev);
168167
Console.WriteLine(authors.Count);
169168

170169
//-------------------------------------------------------------------
171-
authors = dbCmd.Select<Author>();
170+
authors = db.Select<Author>();
172171

173172
Console.WriteLine("Rows in Author : '{0}'",authors.Count);
174173

@@ -181,12 +180,12 @@ public static void Main (string[] args)
181180
author= authors.FirstOrDefault<Author>(r=>r.Name=="Angel Colmenares");
182181
if( author != default(Author) ){
183182

184-
dbCmd.Insert( new Book(){
183+
db.Insert( new Book(){
185184
IdAuthor= author.Id,
186185
Title= "The big book",
187186
Price= 18.55m,
188187
});
189-
Console.WriteLine("{0} == {1}", dbCmd.HasChildren<Book>( author), true ) ;
188+
Console.WriteLine("{0} == {1}", db.HasChildren<Book>( author), true ) ;
190189
}
191190
else{
192191
Console.WriteLine("Something wrong ");
@@ -197,30 +196,30 @@ public static void Main (string[] args)
197196
if( author != default(Author) ){
198197

199198

200-
Console.WriteLine("{0} == {1}", dbCmd.HasChildren<Book>( author), false ) ;
199+
Console.WriteLine("{0} == {1}", db.HasChildren<Book>( author), false ) ;
201200
}
202201
else{
203202
Console.WriteLine("Something wrong ");
204203
}
205204

206-
var books = dbCmd.Select<Book>();
205+
var books = db.Select<Book>();
207206

208207
foreach(var b in books){
209208
Console.WriteLine("Title {0} Price {1}",b.Title, b.Price);
210209
}
211210

212211
ev.Select(r=>new { r.Name, r.Active}).Where(); // only Name and Active fields will be retrived
213212

214-
authors = dbCmd.Select(ev);
213+
authors = db.Select(ev);
215214
Console.WriteLine(ev.SelectExpression);
216215

217216
foreach(Author r in authors){
218217
Console.WriteLine("'{0}' '{1}' '{2}'", r.Name, r.Active, r.Id);
219218
}
220219

221220

222-
dbCmd.DeleteAll<Book>();
223-
dbCmd.DeleteAll<Author>();
221+
db.DeleteAll<Book>();
222+
db.DeleteAll<Author>();
224223

225224

226225
//}

src/FirebirdTests/TestSimpleFirebird01/Main.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ public static void Main (string[] args)
7979

8080
using (IDbConnection db =
8181
"User=SYSDBA;Password=masterkey;Database=employee.fdb;DataSource=localhost;Dialect=3;charset=ISO8859_1;".OpenDbConnection())
82-
using ( IDbCommand dbConn = db.CreateCommand())
8382
{
8483
//try{
8584

8685

87-
dbConn.Insert(new User
86+
db.Insert(new User
8887
{
8988
Name= string.Format("Hello, World! {0}", DateTime.Now),
9089
Password="jkkoo",
@@ -104,22 +103,22 @@ public static void Main (string[] args)
104103
};
105104

106105

107-
dbConn.Insert(user);
106+
db.Insert(user);
108107

109108
Console.WriteLine("++++++++++Id for {0} {1}",user.Name, user.Id);
110109

111110

112-
var rows = dbConn.Select<User>();
111+
var rows = db.Select<User>();
113112

114113
Console.WriteLine("++++++++++++++records in users {0}", rows.Count);
115114
foreach(User u in rows){
116115
Console.WriteLine("{0} -- {1} -- {2} -- {3} -{4} --{5} ", u.Id, u.Name, u.SomeStringProperty, u.SomeDateTimeProperty,
117116
(u.SomeInt32NullableProperty.HasValue)?u.SomeDateTimeNullableProperty.Value.ToString(): "",
118117
u.Active);
119-
dbConn.Delete(u);
118+
db.Delete(u);
120119
}
121120

122-
rows = dbConn.Select<User>();
121+
rows = db.Select<User>();
123122

124123
Console.WriteLine("-------------records in users after delete {0}", rows.Count);
125124

0 commit comments

Comments
 (0)