KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an asp.net-mvc website and I am using nhibernate for my ORM. I have a current controller action that does a basic CRUD update (queries an item from the database and then updates a bunch of values and commits back to the db table). It then returns a simple json response to the client to indicate success or error. public ActionResult UpdateEntity(MyEntity newEntity) { var existingEntity = GetFromRepository(newEntity.Id); UpdateExistingEntity(newEntity, existingEntity); return Json(SuccessMessage); } In certain cases (assuming success of commit and if certain fields are changed in my object) I now want to trigger some additional actions (like emailing a bunch of people and running some code that generates a report) but I don't want to slow down the user experience of the person that is doing the update. So my concern is that if I did this: public ActionResult UpdateEntity(MyEntity newEntity) { var existingEntity = GetFromRepository(newEntity.Id); bool keyFieldsHaveChanged = UpdateExistingEntity(newEntity, existingEntity); if (keyFieldsHaveChanged) { GenerateEmails(); GenerateReports(); } return Json(SuccessMessage); } that it would be too slow for the user experience of someone updating. Is there anyway (asyngc?) to have an expensive operation get triggered off of a controller action but not have that controller action slowed down because of it?
Tags (comma-separated)
Save Edits
Cancel