0

I have a SQL Server database with one table and I am doing operations using Entity Framework 6 in C#.

I have a jQuery in my frontend which calls a method in the C# backend and loads the data from the database using Entity Framework.

Now I want to invoke this method automatically as soon my table in database gets any new rows / data.

I don't want to use SignalR, wants to keep it simple as possible.

I am still figuring out the best possible and easiest way to do this. If I add a trigger on my table in SQL Server, then how it will invoke my jQuery method or C# method?

0

1 Answer 1

1

If I add a trigger on my table in SQL Server, then how it will invoke my jQuery method or C# method?

It can't, at least not directly, without implementing something poorly like a CLR procedure that then invokes your application.

You can look into Query Notifications to potentially accomplish your goals in a more vanilla way, but be warned, you'll probably be the only person in existence actively using this feature:

Built upon the Service Broker infrastructure, query notifications allow applications to be notified when data has changed. This feature is particularly useful for applications that provide a cache of information from a database, such as a Web application, and need to be notified when the source data is changed.

1
  • I am thinking to implement a timer on jQuery UI level, which will invoke my backend method after every 15 seconds.
    – Zohair
    Commented Dec 5, 2022 at 8:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.