Published on

Sitefinity ORM Context Management explained

Authors

This is too good of a google+ thread to not share LINK

If you don’t want to read through, here’s quick summary:

**Do not wrap your managers in using statements

using(DynamicModuleManager manager = DynamicModuleManager.GetManager()){  
   //Code  
}

Why?

Everytime you get a manager, sitefinity stores it for the duration of your http request.  If you dispose it in a using statement it’ll be disposed when that statement completes so the next control\widget that tries to use the manager will have to create a new instance of it (instead of just using the existing shared one).

Think of it like a bucket full of managers