I have a .NET Core MVC application (C#), which uses C++ libraries(SWIG). In the C# I need to create an instance of one of the classes, preset its callback and keep it alive when the server is running. Using this callback I get data from the C++. I've tried to store the object in the session, but I can store only values there:
HttpContext.Session.Set(key, value);
Also tried to define it on Startup
, but the object is disposed after initialization. What is the best solution in this case?
Note: In the callback function I'm publishing the data with SignalR.