aryzac-io / Intent.Modules

Common modules and designers for Intent Architect
https://intentarchitect.com/
0 stars 0 forks source link

[Bug]: 5978511809 - GetAllImplementation strategy thinks it should apply even for unmapped queries #2

Open stephanjohnson opened 6 months ago

stephanjohnson commented 6 months ago

Following error occurs when no mappings:

System.Exception: Nested Compositional Entity LocationSequence doesn't have an Id that refers to its owning Entity Location.
   at Intent.Modules.Application.MediatR.CRUD.CrudStrategies.GetAllImplementationStrategy.GetImplementation() in D:\a\1\s\Modules\Intent.Modules.Application.MediatR.CRUD\CrudStrategies\GetAllImplementationStrategy.cs:line 67
   at Intent.Modules.Application.MediatR.CRUD.CrudStrategies.GetAllImplementationStrategy.ApplyStrategy() in D:\a\1\s\Modules\Intent.Modules.Application.MediatR.CRUD\CrudStrategies\GetAllImplementationStrategy.cs:line 52
   at Intent.Modules.Application.MediatR.CRUD.Decorators.QueryHandlerCrudDecorator.<>c__DisplayClass3_0.<.ctor>b__0(CSharpFile _) in D:\a\1\s\Modules\Intent.Modules.Application.MediatR.CRUD\Decorators\QueryHandlerCrudDecorator.cs:line 40
   at Intent.Modules.Common.CSharp.Builder.CSharpFile.<>c__DisplayClass60_0.<AfterBuild>b__0() in /home/vsts/work/1/s/Modules/Intent.Modules.Common.CSharp/Builder/CSharpFile.cs:line 251
   at Intent.Modules.Common.CSharp.Builder.CSharpFile.AfterBuild() in /home/vsts/work/1/s/Modules/Intent.Modules.Common.CSharp/Builder/CSharpFile.cs:line 286
   at Intent.Modules.Common.Plugins.CSharpFileBuilderFactoryExtension.<>c.<OnBeforeTemplateExecution>b__5_2(ICSharpFileBuilderTemplate x) in /home/vsts/work/1/s/Modules/Intent.Modules.Common.CSharp/FactoryExtensions/CSharpFileBuilderFactoryExtension.cs:line 76
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Intent.Modules.Common.Plugins.CSharpFileBuilderFactoryExtension.OnBeforeTemplateExecution(IApplication application) in /home/vsts/work/1/s/Modules/Intent.Modules.Common.CSharp/FactoryExtensions/CSharpFileBuilderFactoryExtension.cs:line 76
   at Intent.Modules.Common.Plugins.FactoryExtensionBase.Intent.Plugins.FactoryExtensions.IExecutionLifeCycle.OnStep(IApplication application, String step) in /home/vsts/work/1/s/Modules/Intent.Modules.Common/Plugins/FactoryExtensionBase.cs:line 80
   at Intent.SoftwareFactory.SoftwareFactoryProcessOrchestrator.<>c__DisplayClass18_0.<Process>b__17(IExecutionLifeCycle fe) in C:\Dev\Intent\Intent.IntentArchitect\IntentArchitect.SoftwareFactory\Intent.SoftwareFactory\SoftwareFactoryProcessOrchestrator.cs:line 247
   at Intent.SoftwareFactory.FactoryExtensionHelper.<>c__DisplayClass1_1`1.<ExecuteFactoryExtensionAsTask>b__1() in C:\Dev\Intent\Intent.IntentArchitect\IntentArchitect.SoftwareFactory\Intent.SoftwareFactory\FactoryExtensionHelper.cs:line 29
   at Intent.SoftwareFactory.TaskTracker.StartSubTask(String name, Action action, Nullable`1 subTaskCount) in C:\Dev\Intent\Intent.IntentArchitect\IntentArchitect.SoftwareFactory\Intent.SoftwareFactory\TaskTracker.cs:line 54

This scenario only arose because the user didn't "fix" or re-create the mappings after changing the entity from an aggregate to a composite.

Reproduction Steps

stephanjohnson commented 6 months ago

What version of IA and the modules is the client running? I get a completely different error when I reproduce these steps

image

In this case I get the Create Entity Action Target End element exception, and when clear out the services and try to add CRUD services again, I only get the option for Client, because having separate Orders is superfluous. Can we maybe get some more information on this, like, is the correct path not to remove the relevant Service metadata and regenerate from scratch?

I also noticed that if I simply rerun the CRUD script, it duplicates out parts of the services metadata. If my memory serves me correctly, this used to simply add the missing components but would re-use the already existing metadata. I don't think it ever updated anything that existed (ITO Operations and DTO's).

I suspect the strategy just shouldn't apply in this case, also, we should change it to an element exception.

It would seem like something has changed from our side at least in line with the original comment.