public void TestMethod1() { TestDataContext db = new TestDataContext(); db.Set <TransferOrder>().ToList(); db.Set <User>().ToList(); }
public void ListContainsColumn() { var builder = new ExpressionBuilder <User>(); var condition = builder.BuildContains("Id", new int[] { 9, 10 }); var where = builder.Build(condition); var results = db.Set <User>().Where(where).ToList(); Console.WriteLine(results.Count + "条数据"); }
public void WhereToList() { var list = db.Set <User>().Where(x => x.Password == "06ea391fdd9abd6ac43cc858dcc7c4ce" && x.Username == "awfer1").ToList(); //string aa = "呵呵"; //var a=aa.Length; //TestDataContext db = new TestDataContext(); //var date = DateTime.Now; //UnitTest1 t = new UnitTest1(); //db.Set<User>().Select(x => new //{ // Reg = x.RegTime.Date, // x.RegTime.Date, // x.Id, // x.Age //}).Where(x => x.Reg.Date == DateTime.Now.Date && x.Id == 1 && x.Age == 1).ToList(); //db.Set<User>().Select(x => x).Where(x => x.RegTime.Date == DateTime.Now.Date && x.Id == 1 && x.Age == 1).ToList(); //var query = from user in db.Set<User>() select user; }
public void InsertBigData() { var dbUser = db.Set <User>(); for (int i = 0; i < 200000; i++) { dbUser.Add(new User() { LastLoginDate = DateTime.Now, Password = "******", Username = "******", CreateTime = DateTime.Now, IsEnabled = false, Status = T.A }); } db.SaveChanges(); }