EasyAbp / AbpHelper.CLI

Providing code generation and more features to help you develop applications and modules with the ABP framework.
MIT License
285 stars 95 forks source link

Generate CRUD not working with 4.4.0 #150

Closed andre-artus closed 2 years ago

andre-artus commented 3 years ago

It appears the abphelper generate crud (version 0.8.1) does not work against ABP 4.4.0:

Some file names and the folder structure seems to have changed between 4.3.0 and 4.4.0, leading the generate crud command to fail with an System.IO.FileNotFoundException.

desconfiado commented 3 years ago

Same here.

abphelper generate crud Unit -d D:\Temp\VSProjects\TodoApp [17:15:58 INF] Use directory:D:\Temp\VSProjects\TodoApp` [17:15:59 INF] Command 'crud' started.

[17:16:00 DBG] ProjectInfoProviderStep Input [excludeDirectories]: [17:16:00 DBG] ProjectInfoProviderStep Output [projectInfo]: 'BaseDirectory: D:\Temp\VSProjects\TodoApp, FullName: TodoApp, Name: TodoApp, TemplateType: Application, UiFramework: RazorPages, Tiered: False'

[17:16:00 DBG] FileFinderStep Input [excludeDirectories]:

[17:16:00 DBG] FileFinderStep Output [filePathName]: Found file: 'D:\Temp\VSProjects\TodoApp\src\TodoApp.Domain\Units\Unit.cs', stored in parameter: 'FileFinderResult'

[17:16:00 DBG] EntityConstructorsStep Output [modifications]: Modifications count: 0

[17:16:00 DBG] FileModifierStep Input [modifications]: Modifications count: 0

[17:16:00 DBG] TextGenerationStep Input [model]: '{ ProjectInfo = BaseDirectory: D:\Temp\VSProjects\TodoApp, FullName: TodoApp, Name: TodoApp, TemplateType: Application, UiFramework: RazorPages, Tiered: False, Option = EasyAbp.AbpHelper.Core.Commands.Generate.Crud.CrudCommandOption, EntityInfo = EasyAbp.AbpHelper.Core.Models.EntityInfo, InterfaceInfo = , ClassInfo = , Bag = System.Dynamic.ExpandoObject, DtoInfo = EasyAbp.AbpHelper.Core.Models.DtoInfo }'

[17:16:00 DBG] TextGenerationStep Output [text]: Length: 23

[17:16:00 DBG] TextGenerationStep Input [model]: '{ ProjectInfo = BaseDirectory: D:\Temp\VSProjects\TodoApp, FullName: TodoApp, Name: TodoApp, TemplateType: Application, UiFramework: RazorPages, Tiered: False, Option = EasyAbp.AbpHelper.Core.Commands.Generate.Crud.CrudCommandOption, EntityInfo = EasyAbp.AbpHelper.Core.Models.EntityInfo, InterfaceInfo = , ClassInfo = , Bag = System.Dynamic.ExpandoObject, DtoInfo = EasyAbp.AbpHelper.Core.Models.DtoInfo }'

[17:16:00 DBG] TextGenerationStep Output [text]: Length: 28

[17:16:00 DBG] FileFinderStep Input [excludeDirectories]:

[17:16:01 DBG] FileFinderStep Output [filePathName]: Found file: 'D:\Temp\VSProjects\TodoApp\src\TodoApp.EntityFrameworkCore\EntityFrameworkCore\TodoAppDbContext.cs', stored in parameter: 'FileFinderResult'

[17:16:01 DBG] DbContextClassStep Output [modifications]: Modifications count: 0

[17:16:01 DBG] FileModifierStep Input [modifications]: Modifications count: 0

[17:16:01 DBG] FileFinderStep Input [excludeDirectories]:

[17:16:01 ERR] Error while invoking activity activity-23 of workflow 795a7c62d3c842d7be052491704f6dc1 System.IO.FileNotFoundException: TodoAppDbContextModelCreatingExtensions.cs at EasyAbp.AbpHelper.Core.Steps.Common.FileFinderStep.OnExecuteAsync(WorkflowExecutionContext context, CancellationToken cancellationToken) in D:\a\AbpHelper.CLI\AbpHelper.CLI\src\AbpHelper.Core\Steps\Common\FileFinderStep.cs:line 54 at Elsa.Services.ActivityInvoker.InvokeAsync(WorkflowExecutionContext workflowContext, IActivity activity, Func2 invokeAction) [17:16:01 ERR] Error activity: { "SearchFileName": { "Syntax": "JavaScript", "Expression": "${ProjectInfo.Name}DbContextModelCreatingExtensions.cs", "Type": "System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, "Name": "DbContextModel" }

desconfiado commented 3 years ago

The issue above also happens with abp 4.3.0 and helper 0.8.1. Can anyone help with this?

Vayth commented 3 years ago

For a workaround until this is fixed, you can copy ${ProjectInfo.Name}DbContextModelCreatingExtensions.cs file created with 4.3 template, then paste it to EntityFrameworkCore project. You will need some adjustment in db context and may delete it once you don't use it anymore, but at least the other files are created successfully.

wakuflair commented 2 years ago

Please try the latest v0.8.3 version