MineMarket Object States

Objects have an enum property called ObjectState that indicates if the object is temporary, new, clean, dirty, deleting or deleted.

Copy
public enum ObjectState
{
    Temporary = 0,
    New = 1,
    Dirty = 2,
    Clean = 3,
    Deleting = 4,
    Deleted = 5,
}

Some MineMarket objects can be created in the Temporary state and have a constructor allowing the object to be temporary. Temporary objects are outside of the scope of this documentation.

An object that is created using the new statement has an object state of New.

Copy
Shipment shipment = new Shipment();
shipment.State == ObjectState.New

An object that is loaded from the database and has not been edited has an object state of Clean.

Copy
Shipment shipment = Shipment.GetFactory().GetByAlias1("Alias1")[0];
shipment.State == ObjectState.Clean

If an object has been edited; that is, with a property update, it has an object state of Dirty.

Copy
Shipment shipment = Shipment.GetFactory().GetByAlias1("Alias1")[0];
shipment.Name = "New Name";
shipment.State == ObjectState.Dirty;

Object deletion depends on the initial state of the object. If delete is called on new or temporary objects the state is set to Deleted. If delete is called on clean or dirty objects the state is set to Deleting.

For example, the following code sets the object state to Deleting.

Copy
Shipment shipment = Shipment.GetFactory().GetByAlias1("Alias1")[0];
shipment.Delete();
shipment.State == ObjectState.Deleting;

After the Save button has been clicked, the object state is deleted for all objects, regardless of their initial state.