Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete and DeleteRequest do not work for Late-Bound entities in Pipeline Simulation #144

Closed
clurdish opened this issue Apr 26, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@clurdish
Copy link

When using pipeline simulation, late-bound entities work most of the time. However, the framework skips looking for registered plugin steps for Delete requests. This includes both IOrganizationService.Delete(..) and IOrganizationService.Execute(new DeleteRequest {...}).

The following code appears to be where the issue lies.

https://github.com/DynamicsValue/fake-xrm-easy-plugins/blob/2x-dev/src/FakeXrmEasy.Plugins/IXrmFakedContextPipelineExtensions.cs#L459

Within IXrmFakedContextPipelineExtensions.GetPluginStepsForOrganizationRequest, the following code exists. Because the Delete request's target is of type EntityReference, the code looks for a reflected type matching the logical name of the target. Since only late-bound types are used here (i.e. Entity), it will never call context.GetStepsForStage.

//...
else if (target is EntityReference)
{
    var entityReference = target as EntityReference;
    var entityType = context.FindReflectedType(entityReference.LogicalName);
    if (entityType == null)
    {
        return null;
    }

    return context.GetStepsForStage(requestName, stage, mode, (Entity)Activator.CreateInstance(entityType));
}
//...
@jordimontana82 jordimontana82 added the bug Something isn't working label May 3, 2024
@jordimontana82 jordimontana82 self-assigned this May 3, 2024
@jordimontana82
Copy link
Contributor

@clurdish Fix done, it will be resolved in the next release

@jordimontana82
Copy link
Contributor

@clurdish It's on nuget now, lots of other updates there too: https://dynamicsvalue.github.io/fake-xrm-easy-docs/releases/2x/2.5.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants