Open Closed

Entity manager classes created by ABP suite #3331


User avatar
0
ademaygun created
  • ABP Framework version: v5.2.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I create an entity with Abp Suite. Update method was created like this:

public async Task<<Product>> UpdateAsync(
            Guid id,
            string type
        )
        {
            var queryable = await _productRepository.GetQueryableAsync();
            var query = queryable.Where(x => x.Id == id);

            var product = await AsyncExecuter.FirstOrDefaultAsync(query);

            product.Type = type;

            return await _productRepository.UpdateAsync(product);
        }

Why isn't the method created like this?

public async Task<<Product>> UpdateAsync(
            Guid id,
            string type
        )
        {
            var product  = await _productRepository.GetAsync(id);
            product.Type = type;

            return await _productRepository.UpdateAsync(product);
        }

2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I will feedback to the SUITE team.

  • User Avatar
    0
    alper created
    Support Team Director

    thanks for your feedback. the generated code looks complex for the standard inputs. but this format is designed to support navigation properties (1-n, n-n). that's why it looks ugly. I created an internal issue (10906) to make an enhancement on this code.

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