您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LuUtilsPkGuidDataAccess.cs 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Linq.Expressions;
  3. using Luticate2.Utils.DataAccess;
  4. using Luticate2.Utils.Dbo.Filter;
  5. using Test.Utils.DataAccess.Models;
  6. using Test.Utils.Dbo.PkGuid;
  7. namespace Test.Utils.DataAccess
  8. {
  9. public class LuUtilsPkGuidDataAccess : LuEfCrudDataAccess<pk_guid, PkGuidAddDbo, PkGuidDbo, PkGuidAddDbo, LuUtilsDbContext, string>
  10. {
  11. public LuUtilsPkGuidDataAccess(LuUtilsDbContext db) : base(db, db.pk_guid)
  12. {
  13. }
  14. protected override pk_guid GetModelFromTCreate(PkGuidAddDbo obj)
  15. {
  16. return GetModelFromTUpdate(obj, new pk_guid());
  17. }
  18. protected override void EditModelFromTUpdate(PkGuidAddDbo obj, pk_guid model)
  19. {
  20. model.some_int = obj.SomeInt;
  21. model.some_text = obj.SomeText;
  22. }
  23. protected override PkGuidDbo GetDboFromModel(pk_guid model)
  24. {
  25. return new PkGuidDbo
  26. {
  27. CreatedAt = model.created_at,
  28. UpdatedAt = model.updated_at,
  29. Id = model.id.ToString(),
  30. SomeInt = model.some_int,
  31. SomeText = model.some_text
  32. };
  33. }
  34. protected override Expression<Func<pk_guid, bool>> GetFilterExpression(LuFilterDbo filter)
  35. {
  36. return model => LuUtilsDbContext.lu_texts_match(filter.Query, model.some_text + " " + model.some_int.ToString());
  37. }
  38. }
  39. }