We have moved to GitHub Issues
Created by Patrick Scott 30 Oct 2016, 10:26:30 Updated by Patrick Scott 03 Nov 2016, 13:10:41
I have some code which was working pre 7.5.4 (only previously used on 7.4.3). In the MediaService.Saved event if certain conditions are met, I am changing the content type of the just saved media item and then re-saving it. The error below occurs when calling ApplicationContext.Current.Services.MediaService.Save
the error is: "Cannot insert duplicate key row in object 'dbo.cmsPropertyData' with unique index 'IX_cmsPropertyData_1'. The duplicate key value is (1308, fcb1e94b-8a83-4d22-9d26-898aa672dfa0, 250). The statement has been terminated."
I have checked the new media type and it saves if I create this type directly. Also, if I remove this composition/property from the new media type it still errors with a different property.
code used is in files attached.
I am hoping to look at this during next week's hackathon at the UK umbraco festival
It seems to be related to compositions. The code works by copying the default media types without any compositions.
I have changed the event to Saving rather than Saved which has solved the issue for me.
Backwards Compatible: True
Affected versions: 7.5.4
Due in version: