-1

I'm working with asp.net-core 2.2 web api project with angular 7. In this I want to get notifications when a record inserting or updating in specific table. I read many of articles on it with sqldependancy class. But none of them didn't give me any satisfied answer. The thing I want to know is, are there any best approaches to do this work with another way. And if the best approach is,using sqldependecy how to combine it with EntityFramework core?

mNS
  • 1
  • 1
  • 2
    There are a *lot* of good articles and documentation. `none of them didn't give me any satisfied answer.` to get a good answer you need a good *question*. What is *your* question, your requirements? `are there any best approaches` to do what? Get a notification where, the web app, the database, the end user? Do you want that to run immediately or can it wait a bit? How much traffic do you expect? Sending 1 "notification" per minute is very different from 100 per second – Panagiotis Kanavos May 30 '19 at 06:34

1 Answers1

0

You could create an AFTER UPDATE TRIGGER on the table. Depending on how you want to get notified (SQL Mail for example) you could then code for it.

(on a personal note, I hate triggers but this is another way to do it)

Rodney Ellis
  • 727
  • 2
  • 13
  • 28
  • Triggers that would do what? It's impossible to answer the question without knowing what the question actually is. A database trigger can't send a real time notification to a web client for example. On the other hand, there may not be a need for any kind of trigger if polling for changes every 10 minutes is enough – Panagiotis Kanavos May 30 '19 at 06:37
  • 1
    calm down ... he asked for other options. i gave one that cold work, and clarified in saying i don't like triggers myself. i agree the poster could've given more info ... but you shouldn't snap at someone for giving an answer that could do the job. – Rodney Ellis May 30 '19 at 06:41
  • If an answer isn't possible, just don't post an answer. It only creates noise and attracts downvoting. In this case triggers can't work in the scenario addressed by SqlDependency - send a notification to the client. They'd require Message Broker at least and extra infrastructure. That's how SqlDependency works by the way. The important part of the answer is what's behind `you could then code for it.` – Panagiotis Kanavos May 30 '19 at 06:45