public static List <GroupData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups select g).ToList()); }; }
public static List <ContactData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from c in db.Contacts where c.Deprecated == "0000-00-00 00:00:00" select c).ToList()); }; }
public void TestConnectionDB_2() { //берем данные с UI var start = DateTime.Now; var fromUI = app.Groups.GetGroupCashListOptimize(); var end = DateTime.Now; System.Console.Out.WriteLine(end.Subtract(start)); //берем данные с BD start = DateTime.Now; using (var db = new AddressBookDB()) { var fromDB = (from g in db.Groups select g).ToList(); } end = DateTime.Now; System.Console.Out.WriteLine(end.Subtract(start)); }
public void TestConnectionDB() { //берем данные с UI DateTime start = DateTime.Now; List <GroupData> fromUI = app.Groups.GetGroupCashListOptimize(); DateTime end = DateTime.Now; System.Console.Out.WriteLine(end.Subtract(start)); //берем данные с BD start = DateTime.Now; AddressBookDB db = new AddressBookDB(); List <GroupData> fromDB = (from g in db.Groups select g).ToList(); db.Close(); end = DateTime.Now; System.Console.Out.WriteLine(end.Subtract(start)); }