Base solution for your next web application

Activities of "arminm"

Awesome, thanks! clarity makes sense

If it doesn't inherit from FullAuditedEntityDto, then would it automatically add the CreatorUserId on save/update?

so, essentially what you are saying is that because CreatorUserId exists and is NULL, it's getting overwritten? and that if it doesn't exist in the "input" Dto, then the CreatorUserId will be populated on save?

Here is the Dto:

As it's derived from FullAuditedEntityDto, shouldn't it include the populated property?

public class CreateOrEditGroupDto : FullAuditedEntityDto<int?>
    {
		[Required]
		public string Name { get; set; }		
		
		public string Description { get; set; }

        //public Collection<ContactDto> Contacts { get; set; }

    }
public async Task<GetGroupForEditOutput> GetGroupForEdit(EntityDto input)
         {
            var group = await _groupRepository.FirstOrDefaultAsync(input.Id);
            var output = new GetGroupForEditOutput {Group = ObjectMapper.Map<CreateOrEditGroupDto>(group)};

			
			
            return output;
         }

Hi, Perhaps someone can tell me why this would occur.

The CreatorUserId on Update is getting set as NULL, which previously wasn't the case. So I've put in a little bit of a workaround:

private async Task Update(CreateOrEditGroupDto input)
         {
            var group = await _groupRepository.FirstOrDefaultAsync((int)input.Id);
            var x = ObjectMapper.Map(input, group);
            
            // replace creatoruserid hack because it's gone missing
            x.CreatorUserId = AbpSession.UserId;
            await _groupRepository.UpdateAsync(x);
        }

The Create works fine still.

So it's not critical as the workaround is in place, however, I was just wondering if someone had seen this before and perhaps let me know where I have borked it.

Thanks for looking

Answer

Found this little GEM:

Conveyor

try it out. works a charm.

Showing 1 to 5 of 5 entries