MetaGuru
MetaGuru

Reputation: 43873

Does my Controller object get instantiated and destroyed from memory for every Request?

I just don't know if the Controller instance is existing in server memory for a certain period of time after the Request/Response or if it just appears in memory and disappears after each Request/Response. Or if it can depend on certain things, what does it depend on?

Upvotes: 2

Views: 336

Answers (1)

Jeff Sternal
Jeff Sternal

Reputation: 48623

The DefaultControllerFactory will indeed instantiate and destroy the controller instance for each request. (You can browse the source yourself, or see Dino Esposito's article Inside the ASP.NET MVC Controller Factory for a tour.)

Upvotes: 4

Related Questions