public void DeleteEntityTest() { var modified = DateTime.Now; var entry = new Domain.Entities.User { Id = (ulong)DateTime.Now.Ticks, OrgId = 6518750666955952000, CompanyId = 6518750666955952000, Account = "hyl", Role = UserRole.Owner, Name = "何远利", Tel = "18980861011", Mail = "*****@*****.**", Sex = UserSex.Male, Password = "******", Status = CommonStatusEnum.Enabled, Registered = DateTime.Now, Modified = modified }; int i = UserSingleton.AsDeleteable(entry) .Where(x => x.Account) .ExecuteCommand(); }
public void InsertTest() { Prepare(); var modified = DateTime.Now; var entry = new Domain.Entities.User { OrgId = 6518750666955952000, CompanyId = 6518750666955952000, Account = "hyl", Role = UserRole.Owner, Name = "何远利", Tel = "18980861011", Mail = "*****@*****.**", Sex = UserSex.Male, Password = "******", Status = CommonStatusEnum.Enabled, Registered = DateTime.Now, Modified = modified }; int i = userSingleton.AsDeleteable(entry) .Where(x => x.Account ?? x.Tel) .ExecuteCommand(); userSingleton.AsExecuteable() .Where(x => x.Account.Contains("admin")) .Update(x => new Domain.Entities.User { Account = "admin" }); userSingleton.AsUpdateable(entry) .Where(x => new { x.Tel, x.Mail }) .Limit(x => x.Account) .Except(x => x.Id) .ExecuteCommand(); userSingleton.AsExecuteable() .Where(x => x.Id == 1) .Delete(); userSingleton.AsDeleteable(new Domain.Entities.User[] { entry }) .Where(x => x.Id) .ExecuteCommand(); userSingleton.AsExecuteable() .Insert(userSingleton.Take(10).Select(x => new Domain.Entities.User { Id = x.Id + 10000 })); userSingleton.AsInsertable(entry) .ExecuteCommand(); int j = userSingleton .AsInsertable(entry) .ExecuteCommand(); var entity = userSingleton .Where(x => x.Account == "hyl") .FirstOrDefault(); entity.Tel = "18980861111"; entity.Mail = "*****@*****.**"; int k = userSingleton.AsUpdateable(entity) .Limit(x => new { x.Tel, x.Mail }) .Where(x => x.Account) .ExecuteCommand(); var data = userSingleton.Where(x => x.Mail == "*****@*****.**").FirstOrDefault(); }