Hello!
I want to overwrite GetCartQuery response and some validation on data. For that, I am trying to overwrite CartAggregateRepository. I am using the following code to extend this class:
Here are some suggestions to help resolve your issue:
Dependency Declaration in module.manifest: Ensure that you’ve correctly declared the dependency on VirtoCommerce.ExperienceApi in your module.manifest file. Here’s an example of how it should be done:
Placement of AddTransient: The AddTransient registration should be placed inside the Initialize(IServiceCollection services) method of your module. This ensures that your extended repository is properly registered with the dependency injection container. Here’s how you should include it:
public class YourModule : Module
{
public override void Initialize(IServiceCollection services)
{
// Other registrations...
services.AddTransient<ICartAggregateRepository, CartAggregateRepositoryExtended>();
}
}
By addressing these issues, you should be able to successfully modify the price validation rule and override the behavior of the extended repository. Let me know if you have any questions or need further assistance!
If it doesn’t help, ping me and will extend sample with CartAggregateRepositoryExtended.
Add Reference on VirtoCommerce.XPurchase.dll into Data project.
Register dependency on VirtoCommerce.ExperienceApi into module.manfiest. Adjust platform and module version if required. It allows to run your custom module after VirtoCommerce.ExperienceApi.