IContentStoreOpenWriteSession Method
|
Opens a read/write session. This session automatically tracks changes made to any objects that were retrieved within this session.
It also tracks the newly created and to-be-deleted objects. All saves occur when the session is disposed.
If any exceptions occurred before the session is closed, no changes are applied.
This system makes it easy to perform transactional changes and prevents any partial changes due to errors before the session is disposed.
Namespace:
Ingeniux.CMS
Assembly:
Ingeniux.CMS.CSAPI (in Ingeniux.CMS.CSAPI.dll) Version: 10.3.169
Syntax IUserWriteSession OpenWriteSession(
IReadonlyUser user
)
Function OpenWriteSession (
user As IReadonlyUser
) As IUserWriteSession
IUserWriteSession^ OpenWriteSession(
IReadonlyUser^ user
)
abstract OpenWriteSession :
user : IReadonlyUser -> IUserWriteSession
Parameters
- user
- Type: Ingeniux.CMSIReadonlyUser
The user to open the session. All changes must occur via this user account.
Return Value
Type:
IUserWriteSessionThe read/write session.
Remarks The best way to open a session is to use the "using" statement, ensuring it is always disposed properly. If not, make sure to manually dispose the instance.
Examples IReadonlyUser currentUser = store.GetStartingUser(@"yourfirm\youruserid");
using (IUserSession session = store.OpenWriteSession(currentUser))
{
......
}
See Also