SugarList.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace SqlSugar
  6. {
  7. public class MappingTableList : List<MappingTable>
  8. {
  9. public void Add(string entityName, string dbTableName)
  10. {
  11. this.RemoveAll(it => it.EntityName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase));
  12. this.Add(new MappingTable() { EntityName = entityName, DbTableName = dbTableName });
  13. }
  14. public void Add(string entityName, string dbTableName, string dbTableShortName)
  15. {
  16. this.RemoveAll(it => it.EntityName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase));
  17. this.Add(new MappingTable() { EntityName = entityName, DbTableName = dbTableName, DbShortTaleName = dbTableShortName });
  18. }
  19. public new void Clear()
  20. {
  21. this.RemoveAll(it => true);
  22. }
  23. }
  24. public class IgnoreColumnList : List<IgnoreColumn>
  25. {
  26. public void Add(string propertyName, string EntityName)
  27. {
  28. this.RemoveAll(it => it.EntityName == EntityName && it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
  29. this.Add(new IgnoreColumn() { PropertyName = propertyName, EntityName = EntityName });
  30. }
  31. public new void Clear()
  32. {
  33. this.RemoveAll(it => true);
  34. }
  35. }
  36. public class MappingColumnList : List<MappingColumn>
  37. {
  38. public void Add(string propertyName, string dbColumnName, string entityName)
  39. {
  40. this.RemoveAll(it => it.EntityName == entityName && it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
  41. this.Add(new MappingColumn() { PropertyName = propertyName, DbColumnName = dbColumnName, EntityName = entityName });
  42. }
  43. public new void Clear()
  44. {
  45. this.RemoveAll(it => true);
  46. }
  47. }
  48. public class QueueList : List<QueueItem>
  49. {
  50. public void Add(string sql, SugarParameter[] parameters)
  51. {
  52. this.Add(new QueueItem() { Sql = sql, Parameters = parameters });
  53. }
  54. public void Add(string sql, List<SugarParameter> parameters)
  55. {
  56. if (parameters == null)
  57. parameters = new List<SugarParameter>();
  58. this.Add(new QueueItem() { Sql = sql, Parameters = parameters.ToArray() });
  59. }
  60. public new void Clear()
  61. {
  62. this.RemoveAll(it => true);
  63. }
  64. }
  65. }