Please excuse my ignorance -- I am not sure if this is even correct practice, let alone possible to achieve in SharePoint. My self-taught knowledge of SharePoint development was all learned by observing what a predecessor in my position had done.
Basically, I have a "registration app" in SharePoint. Initially, this simple application used BDC (BCS?) to connect to an external SQL Server database to add registrations for classes and perform lookups using CAML queries and external lists.
The use of this application exceeded what it was initially designed for and now the database tables hold about 50k records. The problem now is that these external list lookups take forever. Just submitting a form on the page takes upwards of a minute, which I assume is due to either ineffiencies in the BDC or perhaps my implementation of it.
To resolve the slowness, I opted to create a web API to handle registrations and db lookups (which take less than a second when run on the database directly).
I am attempting to use asynchronous methods in code-behind on a custom page layout. The async calls will post and receive JSON objects between the page and the web API. The async method is hooked up to a button's click event handler. SharePoint immediately errors out when the form is submitted.