-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
68 lines (57 loc) · 1.84 KB
/
Program.cs
File metadata and controls
68 lines (57 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using Models;
using Models.Objects;
using System.Collections.Generic;
using System.Threading;
using System.Linq;
class Program {
static void Main () {
Databasic.Events.Error += (System.Exception ex, Databasic.SqlErrorsCollection sqlErrors) => {
Desharp.Debug.Dump(ex);
Desharp.Debug.Dump(sqlErrors);
};
List<Thread> threads = new List<Thread>();
Thread t;
for (int i = 0; i < 8; i += 1) {
t = new Thread(Program.threadStart(i));
t.IsBackground = true;
threads.Add(t);
t.Start();
}
System.Console.ReadLine();
}
private static ThreadStart threadStart (int i) {
string timerKey = "Thread " + i.ToString();
List<double> times = new List<double>();
return new ThreadStart(delegate {
Desharp.Debug.Timer(timerKey, true);
for (int j = 0; j < 100; j += 1) {
Program.test();
times.Add(Desharp.Debug.Timer(timerKey, true));
}
Desharp.Debug.Dump(times.Average());
});
}
public static void test () {
var d1 = Object.GetById<Dealer>(500);
var d1c = d1.GetClients();
var d1o = d1.GetOrders();
var d1cc = d1.GetClientsCount();
var c1 = Object.GetByKey<Client>(new { Id = 2 });
var c1d = c1.GetDealers();
var c1o = c1.GetOrders();
var c1dc = c1.GetDealersCount();
var o1 = Object.GetById<Order>(740994);
Dealer o1d = o1.GetDealer();
Client o1c = o1.GetClient();
List<Dealer> dealersWithClientsCounts = Dealer.GetWithClientsCounts();
List<Client> clientsWithDealersCounts = Client.GetWithDealersCounts();
var top10newOrds = Object.GetDictionary<int, Order>(
o => o.Id.Value, "Status = 'NEW'", null, "DateSubmit DESC", 0, 10
);
var next10newOrds = Object.GetList<Order>(
"Status = 'NEW'", null, "DateSubmit DESC", 10, 10
);
//Desharp.Debug.Dump(next10newOrds);
Databasic.Connection.Close();
}
}