Share via


Save Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Saves the current order template instance to the underlying database.

Namespace:  Microsoft.CommerceServer.Runtime.Orders
Assembly:  Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)

Syntax

'Declaration
Public Overrides Sub Save
'Usage
Dim instance As OrderTemplate

instance.Save()
public override void Save()
public:
virtual void Save() override
public override function Save()

Exceptions

Exception Condition
SerializationException

A weakly-typed property entry not starting with an underscore ("_") in a class instance was not serializable. All weakly-typed property entries that will be marshaled to storage (i.e., having no underscore prefix to prevent them being marshaled) must be serializable.

ConfiguredLimitExceededException

If you saved this instance to the database you would exceed the specified maximum number of order template instances for this customer. The number of OrderTemplate objects allowed can be set by the sPerUser parameter in the Web.config file.

InvalidOperationException

The current instance has been disposed, either directly or by conversion to a Basket.

Remarks

Saves the current order template instance to the underlying database. Save will update LastModified and store data in the database regardless of whether the OrderTemplate has been modified in any other way. This ensures that the LastModified time reflects the last time any code explicitly called Save.

PurchaseOrder will write to the database only if a property has been modified for the object and the instance has been SetDirty. PurchaseOrder does this as an optimization to cut down on the number of writes to the database.

When a OrderTemplate is serialized and saved to the database, the LastModified field is automatically updated even if no recent changes have been made to the OrderTemplate. Created and LastModified are system properties that are written by the Commerce Server system. If you want to preserve OrderTemplate properties that reflect historical Created and LastModified values, you should create a set of custom properties that are not overridden by the system.

Permissions

See Also

Reference

OrderTemplate Class

OrderTemplate Members

Save Overload

Microsoft.CommerceServer.Runtime.Orders Namespace