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 { public LuUtilsFkPkGuidDataAccess(IServiceProvider serviceProvider) : base(serviceProvider) { } protected override DbSet GetTable(LuUtilsDbContext db) { return db.fk_pk_guids; } protected override IQueryable GetGetQueryable(LuUtilsDbContext db, DbSet 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() }; } } }