123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Linq;
- using Luticate2.Utils.DataAccess;
- using Microsoft.EntityFrameworkCore;
- using TestUtils.DataAccess.Models;
- using TestUtils.Dbo.FkPkGuid;
-
- namespace TestUtils.DataAccess
- {
- public class LuUtilsFkPkGuidDataAccess : LuEfCrudDataAccess<fk_pk_guids, FkPkGuidAddDbo, FkPkGuidDbo, FkPkGuidAddDbo, LuUtilsDbContext, string>
- {
- public LuUtilsFkPkGuidDataAccess(IServiceProvider serviceProvider) : base(serviceProvider)
- {
- }
-
- protected override DbSet<fk_pk_guids> GetTable(LuUtilsDbContext db)
- {
- return db.fk_pk_guids;
- }
-
- protected override IQueryable<fk_pk_guids> GetGetQueryable(LuUtilsDbContext db, DbSet<fk_pk_guids> table)
- {
- return table.Include(guids => guids.fk_pk_guid);
- }
-
- protected override fk_pk_guids GetModelFromTCreate(FkPkGuidAddDbo obj)
- {
- return GetModelFromTUpdate(obj, new fk_pk_guids());
- }
-
- protected override void EditModelFromTUpdate(FkPkGuidAddDbo obj, fk_pk_guids model)
- {
- model.name = obj.Name;
- model.pk_guid_id = obj.PkGuidId == null ? (Guid?) null : new Guid(obj.PkGuidId);
- }
-
- protected override FkPkGuidDbo GetDboFromModel(fk_pk_guids model)
- {
- return new FkPkGuidDbo
- {
- Id = model.id.ToString(),
- Name = model.name,
- PkGuid = model.fk_pk_guid == null ? null : LuUtilsPkGuidDataAccess.GetDboFromModelStatic(model.fk_pk_guid),
- PkGuidId = model.pk_guid_id?.ToString()
- };
- }
- }
- }
|