Open Closed

Updating entity makes properties null when it reaches the AppService. #3437


User avatar
0
jeffbuot created
  • ABP Framework version: v5.3.2
  • UI type: Blazor
  • Project type: Abp Microservice Template
  • DB provider: MongoDB
  • Steps to reproduce the issue: https://www.screencast.com/t/WoXNKgBLfn

Hi, I have attached a link for screencast recording to reproduce the issue. It's weird why updating the Product entity the other properties becomes null. Can anyone explain why it behaves this way and how can I resolve this issue?


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you share the ProductController class code?

  • User Avatar
    0
    jeffbuot created

    Sure, it's just the one from the template it wasn't modified.

    using System;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Mvc;
    using Volo.Abp;
    using Volo.Abp.Application.Dtos;
    
    namespace CMVPoint.ProductService.Products;
    
    [RemoteService(Name = ProductServiceRemoteServiceConsts.RemoteServiceName)]
    [Area("productService")]
    [Route("api/product-service/products")]
    public class ProductController : ProductServiceController, IProductAppService
    {
        private readonly IProductAppService _productAppService;
    
        public ProductController(IProductAppService productAppService)
        {
            _productAppService = productAppService;
        }
    
        [HttpGet]
        public virtual Task<PagedResultDto<ProductDto>> GetListAsync(GetProductsInput input)
        {
            return _productAppService.GetListAsync(input);
        }
    
        [HttpGet]
        [Route("{id}")]
        public virtual Task<ProductDto> GetAsync(Guid id)
        {
            return _productAppService.GetAsync(id);
        }
    
        [HttpPost]
        public virtual Task<ProductDto> CreateAsync(ProductCreateDto input)
        {
            return _productAppService.CreateAsync(input);
        }
    
        [HttpPut]
        [Route("{id}")]
        public virtual Task<ProductDto> UpdateAsync(Guid id, ProductUpdateDto input)
        {
            return _productAppService.UpdateAsync(id, input);
        }
    
        [HttpDelete]
        [Route("{id}")]
        public virtual Task DeleteAsync(Guid id)
        {
            return _productAppService.DeleteAsync(id);
        }
    }
    
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    It looks like no problem, Can you share a project with me or full steps to reproduce? shiwei.liang@volosoft.com I will check it out.

  • User Avatar
    0
    jeffbuot created

    Hi,

    It looks like no problem, Can you share a project with me or full steps to reproduce? shiwei.liang@volosoft.com I will check it out.

    I invited you to a private github repository.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Got it, checking.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Because you are using the protected set for ProductUpdateDto. just need to remove protected and it will work.

  • User Avatar
    0
    jeffbuot created

    Hi,

    Thank you, I haven't noticed that!

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11