EntityFramework - deploy custom stored procedures to Azure
Continuing on my previous post regarding EF-Azure for project IOnline, I need to adapt this requirement to: (1) Not using EF to count number of messages (total messages in the system and by categories) and (2) Use Dapper for the data access layer as a replacement. So I will have to create some stored procedures to make this works.
1. Create stored procedures and references to Dapper
Below is the SP needs to be created
The application will function after implemented a new service using Dapper.
2. Enable migration
If the system runs on another database or Azure platform it doesn't work unless the script was deployed manually. Again, it should be deployed automatically with continuous integration enabled. So a new migration is needed.
The above migration was empty when running
Add-Migration command because no change has been made on the model.
To integrate the SP, new properties UpScripts and DownScripts are created which contains
sql statements to perform the migration.
And that's all from our side, the rest is EF it will perform
Update-Database on the first read/write db operation.
We can take a coffee and see new affects after
push those changes, Azure handles all other steps.