Click or drag to resize

The Manager Objects


Concept

In the CSAPI, manager objects are in charge of managing one or more types of entities collections. All entity types are managed by a particular manager type. For example, ISite manages IPage.

All manager objects are retrieved from an IUserSession instance and should only live within the scope of the current session. A manager object doesn't function if the session it belongs to is closed or disposed.

C#
CMS_Common common = CMS_Common.GetCommonInstance(context.Request.RequestContext);
IContentStore contentStore = common.ContentStore;
IReadonlyUser currentUser = store.GetStartingUser(@"yourfirm\youruserid");

using (IUserSession session = store.OpenWriteSession(currentUser))
{
       IUserManager userManager = session.UserManager;
       IUser author1 = userManager.User("ingeniux\author1");
       ...
}

Note that manager objects are created only once per session. It is always the same manager instance being referred returning from a particular manager property on the IUserSession object.

The Managers
See Also