ASP.net MVC: Where to store application data?

I am just starting to port the application to ASP.net MVC, and I have an object that supports the application (it monitors certain processes running on the machine when it starts and stops, if necessary, and sends / receives an MSMQ message).

Where should I store this object? In my current application (based on HttpListener) this is singleton, however I know that singletones make testing difficult. It would be difficult to ridicule or test this object, at least in the context of the MVC application itself, and in any case, it has its own set of tests outside the application. However, it may be necessary to replace it with a test plug.

The object must be accessible to multiple controllers. Where should I store this object and how to make it accessible to controllers? I have never seen a case like the one described in any ASP.net MVC examples I saw.

UPDATE:

I think I need to explain why I cannot store this data in a database. First I have to explain what the application does:

The application serves images that are generated dynamically using several "engines", which are processes running on the server that are transmitted through MSMQ. Lets you call the object I'm asking about the EngineManager about. The process looks something like this:

  • The client sends an XML request to the server, specifying the name "engine", as well as a number of parameters describing the image.
  • EngineManager, , . , .
  • MSMQ .
  • .
  • , , .
  • , .

, , . EngineManager, , .

, - .

+3
3

, , .. , :

http://msdn.microsoft.com/en-us/library/bf9xhdz4(VS.71).aspx

, , , , , . , Applciation . , .

+1

Controller, , Controller.

ControllerFactory, ASP.NET MVC, . , - (, Autofac), .

+2

Store application data in a database and access it using the model layer. The client only saves the session identifier.

-3
source

Source: https://habr.com/ru/post/1707404/


All Articles