-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Michael Köster edited this page Aug 7, 2021
·
6 revisions
The implementation for persistent classes is fast and easy.
How to implement:
- Add the PessimisticLocker.Module to your project.
- Set OptimisticLocking(false) in your class
- Add the IPessimisticLocking interface to your class
- Implement the IPessimisticLocking.Id property
- Run your application
Examples:
[OptimisticLocking(false)]
public class Contact : BaseObject, IPessimisticLocking
{
public string Id => Oid.ToString();
public Contact(Session session)
: base(session)
{
}
private string name;
public string Name
{
get { return name; }
set { SetPropertyValue(nameof(Name), ref name, value); }
}
}
[OptimisticLocking(false)]
public class Company : XPObject, IPessimisticLocking
{
public string Id => Oid.ToString();
public Company(Session session)
: base(session)
{
}
private string name;
public string Name
{
get { return name; }
set { SetPropertyValue(nameof(Name), ref name, value); }
}
}