Starts in:
2 DAYS
16 HRS
49 MIN
27 SEC
Starts in:
2 D
16 H
49 M
27 S
Open Closed

Abp Suite Domain Service Generation Errors #5106


User avatar
2
dweiss created
  • ABP Framework version: v7.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:Create and entity in a Module in abp Suite. Add a property, click save and generate. View the Domain Service Generated Code."
  • Hello, I've recently upgraded to version 7.2.2 of abp suite and framework CLI. Upon generating an entity in Suite I'm presented with what looks like placeholders for the method generation i.e. %%Validations%% and %%Method Parameters%%. Please advise. I created a simple entity named Test as an example with a singular bool property called IsAlive.
 public class TestManager : DomainService
    {
        private readonly ITestRepository _testRepository;

        public TestManager(ITestRepository testRepository)
        {
            _testRepository = testRepository;
        }

        public async Task<Test> CreateAsync(
        %%method-parameters%%)
        {
            %% validations %%

            var test = new Test(
             GuidGenerator.Create(),
             isAlive
             );

            return await _testRepository.InsertAsync(test);
        }

        public async Task<Test> UpdateAsync(
            Guid id,
            %%method-parameters%%, [CanBeNull] string concurrencyStamp = null
        )
        {
            %% validations %%

            var test = await _testRepository.GetAsync(id);

            test.IsAlive = isAlive;

            test.SetConcurrencyStampIfNotNull(concurrencyStamp);
            return await _testRepository.UpdateAsync(test);
        }

    }
}```

7 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    did you also update your ABP Suite to v7.2.2 ABP Suite and your project version must be the same

  • User Avatar
    0
    dweiss created

    did you also update your ABP Suite to v7.2.2 ABP Suite and your project version must be the same

    Thank you for getting back. I had already updated the abp suite and all projects to version 7.2.2. Please see screenshots below for reference.

    hi there, I hope this helps, but as a test, I generated a brand new module solution in the suite and generated an entity. I got the same result. Please let me know if I can provide you with any more information.

    `public class AnotherEntityTestManager : DomainService { private readonly IAnotherEntityTestRepository _anotherEntityTestRepository;

        public AnotherEntityTestManager(IAnotherEntityTestRepository anotherEntityTestRepository)
        {
            _anotherEntityTestRepository = anotherEntityTestRepository;
        }
    
        public async Task<AnotherEntityTest> CreateAsync(
        %%method-parameters%%)
        {
            %% validations %%
    
            var anotherEntityTest = new AnotherEntityTest(
             GuidGenerator.Create(),
             isAlive
             );
    
            return await _anotherEntityTestRepository.InsertAsync(anotherEntityTest);
        }
    
        public async Task<AnotherEntityTest> UpdateAsync(
            Guid id,
            %%method-parameters%%, [CanBeNull] string concurrencyStamp = null
        )
        {
            %% validations %%
    
            var anotherEntityTest = await _anotherEntityTestRepository.GetAsync(id);
    
            anotherEntityTest.IsAlive = isAlive;
    
            anotherEntityTest.SetConcurrencyStampIfNotNull(concurrencyStamp);
            return await _anotherEntityTestRepository.UpdateAsync(anotherEntityTest);
        }
    
    }`
    
  • User Avatar
    0
    dweiss created

    did you also update your ABP Suite to v7.2.2
    ABP Suite and your project version must be the same

    Thank you for getting back. I had already updated the abp suite and all projects to version 7.2.2. Please see screenshots below for reference.

    hi there, I hope this helps, but as a test, I generated a brand new module solution in the suite and generated an entity. I got the same result. Please let me know if I can provide you with any more information.

    `public class AnotherEntityTestManager : DomainService { private readonly IAnotherEntityTestRepository _anotherEntityTestRepository;

        public AnotherEntityTestManager(IAnotherEntityTestRepository anotherEntityTestRepository) 
        { 
            _anotherEntityTestRepository = anotherEntityTestRepository; 
        } 
    
        public async Task<AnotherEntityTest> CreateAsync( 
        %%method-parameters%%) 
        { 
            %% validations %% 
    
            var anotherEntityTest = new AnotherEntityTest( 
             GuidGenerator.Create(), 
             isAlive 
             ); 
    
            return await _anotherEntityTestRepository.InsertAsync(anotherEntityTest); 
        } 
    
        public async Task<AnotherEntityTest> UpdateAsync( 
            Guid id, 
            %%method-parameters%%, [CanBeNull] string concurrencyStamp = null 
        ) 
        { 
            %% validations %% 
    
            var anotherEntityTest = await _anotherEntityTestRepository.GetAsync(id); 
    
            anotherEntityTest.IsAlive = isAlive; 
    
            anotherEntityTest.SetConcurrencyStampIfNotNull(concurrencyStamp); 
            return await _anotherEntityTestRepository.UpdateAsync(anotherEntityTest); 
        } 
    
    }` 
    

    Good morning. Is this being worked on as part of a patch release or is there something I can do locally to fix this?

  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    Hi @dweiss

    • Can you check the version of Volo.Abp.Commercial.SuiteTemplates package? Is it 7.2.2 too?

    • Have you overriden the domain manager template for this project?

    Most likely you have overriden the template. Because normally CreateAsync and UpdateAsync method has return values in their signatures. Example:public async Task<AnotherEntityTest> CreateAsync. but in your case there are no <AnotherEntityTest> in the generated code. I've checked the previous Suite versions and i could not find a version that generates these methods without return values. That is why i think you've overriden them. To undo the override, go to Templates page in suite and revert the customization for Server.Domain.Manager.txt.

    If you have never override the template, i will check again. For now i don't see any other reason than i explained.

  • User Avatar
    0
    dweiss created

    Hi @dweiss

    • Can you check the version of Volo.Abp.Commercial.SuiteTemplates package? Is it 7.2.2 too?

    • Have you overriden the domain manager template for this project?

    Most likely you have overriden the template. Because normally CreateAsync and UpdateAsync method has return values in their signatures. Example:public async Task<AnotherEntityTest> CreateAsync. but in your case there are no <AnotherEntityTest> in the generated code. I've checked the previous Suite versions and i could not find a version that generates these methods without return values. That is why i think you've overriden them. To undo the override, go to Templates page in suite and revert the customization for Server.Domain.Manager.txt.

    If you have never override the template, i will check again. For now i don't see any other reason than i explained.

    Hi @yekalkan, Thank you for getting back. I have not modified any of the Templates but perhaps something went wrong when I upgraded via the CLI. I have since downgraded our main solution and modules back to 7.1.1 to move on from the issue as we have deliverable dates approaching. However, the dummy solution project I created above was pointed at the correct package you had listed.

    Project Sdk="Microsoft.NET.Sdk">

    <Import Project="....\common.props" />

    <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <Nullable>enable</Nullable> <RootNamespace>DummyModule</RootNamespace> </PropertyGroup>

    <ItemGroup> <PackageReference Include="Volo.Abp.Commercial.SuiteTemplates" Version="7.2.2" /> </ItemGroup>

    </Project>

    At a later date we will try this upgrade again but that won't be for a week or so. Based on what you said, I have an idea of what could have happened. What project does the Suite look at for the templates (Where that dll gets stored and referenced by the suite)? I've had an issue in the past that even though the NuGet packages were updated correctly and display so in the project configurations, the dll being added to the bin folder on build did not match the version listed as a package reference. Cleaning and Rebuilding did not resolve this but deleting the obj/bin folders through abp clean might. After this release cycle I'll try again and will post if there are issues.

  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    What project does the Suite look at for the templates (Where that dll gets stored and referenced by the suite)?

    Volo.Abp.Commercial.SuiteTemplates has the templates. You need to build your solution after updating this package.

  • User Avatar
    1
    dweiss created

    What project does the Suite look at for the templates (Where that dll gets stored and referenced by the suite)?

    Volo.Abp.Commercial.SuiteTemplates has the templates. You need to build your solution after updating this package.

    Hi @yekalkan, I'm going to close this as answered as I believe the issue was a lingering dll that wasn't cleaned up after the upgrade even after a rebuild. When we attempt the next upgrade, I will try a full ABP clean after updating the suite, framework and projects, that way I believe the suite will prompt for the build of the solution.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06