How to modify Order limits for non-web based Commerce Server applications?

So you probably know all about how to change the various limits (such as the maximum Baskets per user or LineItems per OrderForm) on Orders being placed on your web site using the Limits Element in the Orders Element in the Web.Config.

Well, if you have ever wondered how the same settings can be controlled for non-web applications (such as in a commerce console application which might be doing your unit testing) the answer is via the an application configuration file (app.config). Just make sure you add the required <sectionGroup> entry for CommerceServer and an entry for each section, such as Orders, that will be present in the app.config file. An app.config which would have some custom Order limits would look something like:

<configuration>

<

configSections>

<

sectionGroup name="CommerceServer">

<

section name="orders" type="Microsoft.CommerceServer.Runtime.Configuration.CommerceOrdersSectionHandler, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

</

sectionGroup>

</

configSections>

<

CommerceServer>

<

orders newOrderStatus="NewOrder">

<

Limits BasketsPerUser="5" />

</

orders>

</

CommerceServer>

</

configuration>