Share static variables between projects to build WebAPI
So, I already searched on google but couldn't find anything. I have two projects, one is a discord bot, the second one is a WebAPI project to interact with the bot via Web. However i need some instances of some classes in the WebAPI project to retrieve/send informations.
I read about DLLs sharing static stuff but having the WebAPI running on another process (IIS Server), the context isn't shared so it's like a brand new one, pretty useless.
Possible solution: Named pipes / MemoryMappedFile, but that would mean more code in the bot to continuously update the values of the variables + serialization + possible desync (?)
Is there any way to integrate WebAPIs in the same "scope" of the main application?
Thank you.
3 Replies
If these apps will be on the same device(i suspect they will, otherwise how would you have them in the same process?) You can just read/write some file
Wouldn't that be slow?
+ file access in a full async env. it's kinda a pain in the a**
btw thanks for the hint
There probably is another way, this is the only i know