AcModels improvements...

This commit is contained in:
jozsef.b@aycode.com 2024-06-03 19:04:23 +02:00
parent a883b368bf
commit 2c9bf7fd08
2 changed files with 18 additions and 4 deletions

View File

@ -13,12 +13,15 @@ public abstract class AcModelDtoBase : IAcModelDtoBase
public abstract class AcModelDtoBase<TMainEntity> : AcModelDtoBase, IAcModelDtoBase<TMainEntity> where TMainEntity : IEntityGuid public abstract class AcModelDtoBase<TMainEntity> : AcModelDtoBase, IAcModelDtoBase<TMainEntity> where TMainEntity : IEntityGuid
{ {
protected AcModelDtoBase() { } protected AcModelDtoBase() : base() { }
protected AcModelDtoBase(Guid id) : this() => Id = id; protected AcModelDtoBase(Guid id) : base(id) { }
protected AcModelDtoBase(TMainEntity mainEntity) : this(mainEntity.Id) { } protected AcModelDtoBase(TMainEntity mainEntity) : this(mainEntity.Id) { }
public virtual TMainEntity CreateMainEntity() public virtual TMainEntity CreateMainEntity()
{ {
throw new NotImplementedException(); var mainEntity = Activator.CreateInstance<TMainEntity>();
mainEntity.Id = Id;
return mainEntity;
} }
} }

View File

@ -6,7 +6,7 @@ using AyCode.Interfaces.Users.Dtos;
namespace AyCode.Models.Users; namespace AyCode.Models.Users;
public abstract class AcUserModelDtoMinBase<TUserDtoMin, TProfileDto> : AcModelDtoBase, IAcUserModelDtoMinBase public abstract class AcUserModelDtoMinBase<TUserDtoMin, TProfileDto> : AcModelDtoBase, /*AcModelDtoBase<IAcUserDtoMinBase<TProfileDto>>,*/ IAcUserModelDtoMinBase
where TUserDtoMin : class, IAcUserDtoMinBase where TUserDtoMin : class, IAcUserDtoMinBase
//where TProfile : class, IAcProfileDtoBase //where TProfile : class, IAcProfileDtoBase
where TProfileDto : class, IAcProfileDtoBase where TProfileDto : class, IAcProfileDtoBase
@ -31,4 +31,15 @@ public abstract class AcUserModelDtoMinBase<TUserDtoMin, TProfileDto> : AcModelD
ProfileDto.LastName = user.Profile.LastName; ProfileDto.LastName = user.Profile.LastName;
//Profile.NickName = user.Profile.NickName; //Profile.NickName = user.Profile.NickName;
} }
//public virtual TUserDtoMin CreateMainEntity()
//{
// var user = base.CreateMainEntity();
// user.AffiliateId = UserDto.AffiliateId;
// user.ProfileId = ProfileDto.Id;
// user.Profile = Activator.CreateInstance<>()
//}
} }