Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

RemoveAssociation really slow after recent update


I have recently upgraded to Commerce 13.30.0 and ever since our scheduled job that imports products is running incredibly slow. Before the update it would run in minutes. Now it will take hours. 

This scheduled job pulls in products from an external REST service on our end.

I have narrowed it down to the  "_associationRepository.RemoveAssociation(association)" call of the following function:

public async Task<List<Association>> Import(IServiceLayerApi serviceLayerApi, KitContent kitContent)
            var bomInfo = await GetBomInformationRecursive(serviceLayerApi, kitContent.Code);

            var associations = bomInfo
                .Select(x => CreateAssociation(kitContent.ContentLink, x))
                .Where(x => x != null)

            var existing = _associationRepository.GetAssociations(kitContent.ContentLink).ToArray();
            foreach (var association in existing)

            return associations;

When i remove the foreach loop with the RemoveAssociation call the scheduled job goes back to taking only a minute.

Is there something that changed from Commerce 13.29 to 13.30 that would cause this slow down?

Thank you,


May 07, 2021 19:36

I will look into this and get back to you. 

May 10, 2021 12:28

You don't have to call foreach, just 


should be enough.

I'm not quite sure why it is much slower thought. Could you profile it using dotTrace to see where the bottlenecks are ?

May 10, 2021 13:08
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.