JsonToJoinModels.cs 950 B

12345678910111213141516171819202122232425262728293031
  1. using Newtonsoft.Json.Linq;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. namespace SqlSugar
  8. {
  9. /// <summary>
  10. /// Json to model
  11. /// </summary>
  12. public partial class ContextMethods : IContextMethods
  13. {
  14. public JoinModel JsonToJoinModels(string json)
  15. {
  16. JoinModel conditionalModels = new JoinModel();
  17. var array = JArray.Parse(json);
  18. Check.Exception(array.Count != 3, json + " format error");
  19. var tableName = array[0];
  20. var shortName = array[1];
  21. var onWhere = array[2];
  22. JoinModel result = new JoinModel();
  23. result.TableName = tableName.ObjToString().ToCheckField();
  24. result.ShortName = shortName.ObjToString().ToCheckField();
  25. result.OnWhereList = JsonToSqlFuncModels(onWhere);
  26. return result;
  27. }
  28. }
  29. }