Add Submission Count Method to IPermanentStorage

Vote:
 

51 requests are made to LoadSubmissionFromStorage in IPermanentStorage when rendering the form submissions table in edit view. One request fetches all the submission data for the table, and 50 requests are made for the 50 days in the form submission chart from Episerver.Forms.Core.Data.FormdataRepository.GetSubmissionDataCount

When implementing encryption of form submissions, if one does not want the drawbacks of the encryption method included out of the box (https://devblog.gosso.se/2017/12/encrypting-form-submissions-episerver-forms/), one can implement encryption in a custom implementation of IPermanentStorage

However, if LoadSubmissionFromStorage is supposed to return decrypted data, the decryption process is initiated 51 times. Encryption keys are fetched for each submission (could be many) and each submission data field (many submissions, each with many fields) is decrypted. This is resource-intensive and does not scale well.

DdsPermanentStorage (default implementation of IPermanentStorage) simply returns an IQueryable with the form submission. On the other hand, our custom implementation of IPermanentStorage has to decrypt the data first in order to deliver on the method name - loading the submissions from storage. 

Is it possible for Episerver.Forms.Core.Data.FormdataRepository.GetSubmissionDataCount to simply use another method than LoadSubmissionFromStorage to get the submission count?

For instance, a new method named something like CountSubmissionsInStorage could be implemented in DdsPermanentStorage by calling LoadSubmissionFromStorage, since there is no decryption overhead associated with the request. This would enable us to return the submission count in a custom implementation of IPermanentStorage with significantly less overhead, and without loading the actual submissions from storage and decrypting them only to find the number of submissions.  

Best regards, 
Eivind

#206931
Edited, Sep 04, 2019 11:30