Skip to content

OrderItem

Class public
Represents a single line item within an Order, capturing the product, quantity, and price at the time of purchase.
Namespace SampleApi
Assembly SampleApi
Package v1.0.0.0
public class OrderItem
Prices are captured at order time and do not change if the product's catalogue price is updated later. The line total can be calculated as Quantity * UnitPrice.
string
string OrderItem.ProductName

Gets or sets the display name of the product being ordered.

This is a snapshot of the product name at order time. It is stored denormalized so that the order remains readable even if the product is renamed or removed from the catalogue.
int OrderItem.Quantity

Gets or sets the number of units ordered.

Must be a positive integer. Defaults to 1.
decimal
decimal OrderItem.UnitPrice

Gets or sets the unit price of the product at the time the order was placed.

Stored as a Decimal to avoid floating-point rounding errors in financial calculations.