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.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 20, 2025, 18:00