LineItem Constructor (String, String, String, Decimal)
Initializes a new instance of the LineItem class using the specified product catalog, product ID, product variant ID, and quantity information.
Namespace: Microsoft.CommerceServer.Runtime.Orders
Assembly: Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)
Syntax
'Declaration
Public Sub New ( _
productCatalog As String, _
productId As String, _
productVariantId As String, _
quantity As Decimal _
)
'Usage
Dim productCatalog As String
Dim productId As String
Dim productVariantId As String
Dim quantity As Decimal
Dim instance As New LineItem(productCatalog, _
productId, productVariantId, quantity)
public LineItem(
string productCatalog,
string productId,
string productVariantId,
decimal quantity
)
public:
LineItem(
String^ productCatalog,
String^ productId,
String^ productVariantId,
Decimal quantity
)
public function LineItem(
productCatalog : String,
productId : String,
productVariantId : String,
quantity : decimal
)
Parameters
- productCatalog
Type: System..::.String
The product catalog to which this line item belongs.
- productId
Type: System..::.String
The unique product identifier for the current instance as specified in the catalog.
- productVariantId
Type: System..::.String
The product variant for the current instance. For example, a shirt with three sizes might be represented by three variants.
- quantity
Type: System..::.Decimal
The quantity of new items.
Exceptions
Exception | Condition |
---|---|
ArgumentException | quantity is less than zero. The quantity must be greater than or equal to zero. -OR-The length of productCatalog, productId, or productVariantId parameters is greater than the maximum specified in the Orders storage mapping file. |
ArgumentNullException | ProductCatalog or ProductId is nullNothingnullptra null reference (Nothing in Visual Basic). Make sure that both parameters passed to the method are not nullNothingnullptra null reference (Nothing in Visual Basic). |
InvalidOperationException | quantity is not a whole number. |
Remarks
String parameters are trimmed of leading and trailing white space before being set.
The default maximum length for productCatalog, productId, and productVariantId is 255 characters, as defined in the corresponding table column constraints specified in the default Orders storage mapping file, OrderObjectMappings.xml.
LineItem represents a single line item. LineItem implements IEnumerable to allow easy enumeration over all weakly-typed properties of the line item.
The order capture system assigns a unique integer to every line item for every OrderForm. Upon removal of an item, these integer index values are recomputed. Line items are created as stand-alone entities, and are then added to the LineItemCollection.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.