In every app, we are always getting requests that simply take data from a file and import them into the system or export from system to file/ftp etc. This is mostly used internally by the administrators. Basically they need a screen to enter some info, click a button and the import/export will be carried out.
The system I am developing is using n-tier architecture: Web App (Browser) > Controller > WCF Service > Data Layer > Db.
I have created a design and it is currently in use which basically works like this:
- Create a screen
- Controller will create an instance of a class that has some info in it such as the name of the stored procedure, the parameters to the stored procedure etc. and submit this to the WCF service.
- The WCF service, the repository will be re-used since it simply forwards the request over to the db and performs some security work. The repository will issue the request to the correct stored procedure to be executed.
- The appropriate stored procedure is executed and the result is exported to a file by TSQL or imported into the db.
- Some result is returned to client.
The above solution is good, I guess, since I just need to create the screen, the controller method and the stored procedure. The stuff in between can be reused.
Although it is implementation leakage but this is for our internal use. These operations can never be called by the public. It is controllerd using authentication/authorization. This design results in less work for us and we can satisfy such requests pretty quickly with minimal coding.
If you could please shine some light on the above approaches or share what you have done in the past, that will be great!