I initialize the class on the controller, but with each request to the controller it initializes the class. How can I avoid it?

public class ValuesController: ApiController {

IFaceRecognition recognition = new Recognition(); 

tried to do so but don’t know where to pass the IFaceRecognition rec

 IFaceRecognition recognition; public ValuesController(IFaceRecognition rec) { recognition = rec; } 

How to make the controller initialize the class for each request

PS read what you can through Singleton, but I do not know how to do it. The class Recognition is bound to the dll I make requests every 100 milliseconds and the server crashes

    0