You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB

2 years ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using SqlSugar;
  7. using OrmTest.Models;
  8. namespace OrmTest.PerformanceTesting
  9. {
  10. public class SqlSugarPerformance : PerformanceBase
  11. {
  12. public SqlSugarPerformance(int eachCount)
  13. {
  14. this.count = eachCount;
  15. }
  16. public void Select()
  17. {
  18. SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
  19. {
  20. ConnectionString = Config.ConnectionString,
  21. DbType = DbType.SqlServer,
  22. IsAutoCloseConnection = false
  23. });
  24. db.IgnoreColumns.Add("TestId", "Student");
  25. db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList();
  26. base.Execute("sqlsuagr", () =>
  27. {
  28. var test = db.Queryable<Student>().Select(it => new ViewModelStudent2 { Name = it.Name, Student = it }).ToList();
  29. });
  30. db.Close();
  31. }
  32. }
  33. }