Updating Html Table when data is added to mongo db
I am making a asp.net core mvc application and I wanna add data to my table every time a entry is added to my mongodb?
I have tried using SignalR but it wont work? any ideas on how I could do it
13 Replies
yeah use java
Sure, SignalR will work for real-time communication
Im trying to do that atm but I keep getting errors
let me send over my code
!ban 574584522541367306 Here to troll, ✌️
Anything im doing wrong?
You mentioned errors. What would they be?
let me re run it and send hold on
Also, why
object
?What would be better?
System.NullReferenceException: 'Object reference not set to an instance of an object.'
on this line
var hubContext = this.HttpContext.RequestServices.GetRequiredService<IHubContext<Noble.Hub.TableHub>>();
The... actual type would be better
Whatever type represents your data
And the error tells you something here is
null
So ig try to figure out what that is, with the help of the debugger
Also, why GetRequiredServices
instead of using the DI container and injecting it?
Also also, async
method calls have to be await
edThe problem is its not null since im literally using the data object in other parts in the same function
Something is
null
Could be HttpContext
Could be the result of GetRequiredServices()
Could be RequestServices
Somethingalright Ill take a look
Yeah this was the problem
Thanks mate