123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Linq.Expressions;
- using Luticate2.Utils.DataAccess;
- using Luticate2.Utils.Dbo.Filter;
- using Luticate2.Utils.Utils;
- using Test.Utils.DataAccess.Models;
- using Test.Utils.Dbo.PkGuid;
-
- namespace Test.Utils.DataAccess
- {
- public class LuUtilsPkGuidDataAccess : LuEfCrudDataAccess<pk_guid, PkGuidAddDbo, PkGuidDbo, PkGuidAddDbo, LuUtilsDbContext>
- {
- public LuUtilsPkGuidDataAccess(LuUtilsDbContext db) : base(db, db.pk_guid)
- {
- }
-
- protected override pk_guid GetModelFromTCreate(PkGuidAddDbo obj)
- {
- return GetModelFromTUpdate(obj, new pk_guid());
- }
-
- protected override void EditModelFromTUpdate(PkGuidAddDbo obj, pk_guid model)
- {
- model.some_int = obj.SomeInt;
- model.some_text = obj.SomeText;
- }
-
- protected override PkGuidDbo GetDboFromModel(pk_guid model)
- {
- return new PkGuidDbo
- {
- CreatedAt = model.created_at,
- UpdatedAt = model.updated_at,
- Id = model.id.ToString(),
- SomeInt = model.some_int,
- SomeText = model.some_text
- };
- }
-
- protected override Expression<Func<pk_guid, bool>> GetFilterExpression(LuFilterDbo filter)
- {
- return model => LuUtilsDbContext.lu_texts_match(filter.Query, model.some_text + " " + model.some_int.ToString());
- }
- }
- }
|