What’s New

While modifying and saving existing product using commerce server API, I am getting Optimistic lock exception. As per Commerce server documentation, OptimisticLockException can be thrown in following cases

  • when an attempt is made to save an entity and it is detected that the database record has been modified since the time the entity being edited was retrieved from the database. Commerce server feels this process as a safety mechanism to prevent one author from inadvertently overwriting the changes of another author.
  • For individual entity (like products, advertisement, discounts, etc) updates, this is determined by comparing the last modified date of the entity to the last modified date of the database record.
  • For bulk updates (and resource table entities) this is determined by comparing the original DataSet values with those currently in the database.

After analysing the code, I figured out that I am overriding last modified date value in the code. So, what is happening – On save, commerce server is comparing last modified date with the value in databases. Since both values are different it is throwing exception feeling that someone might of updated the entity and to prevent inadvertent overwriting it is throwing exception. So, the remedy is NOT TO UPDATE LASTMODIFIED VALUE. I commented the line of code which is updating last modified date and the application started working fine.

Related Articles


If you like this post, please click on our sponsor advertisement.


So far we have seen very nice demo/video on how can we use commerce server 2009 to develop mobile application (especially windows mobile). Today while browsing YouTube, I found that De care Systems have developed a demo IPhone application which is integrated with Microsoft Commerce Server 2009. Its a unique extension to the CS09 platform that provides retailers with a seamless route to mobile retailing.

Related Articles


If you like this post, please click on our sponsor advertisement.


I am delighted to convey to my blog readers that UK best buy website went live last week. The application has variety of features and is totally aligned to the current ecommerce business needs. The application is developed using latest technologies like Commerce server 2007, APS.NET custom MVC framework, etc. and integrates with many backed systems. It has quite a good number of features for any ecommerce application reference.

Please take time to visit and see some very familiar features live…

http://www.bestbuy.co.uk

I spend almost a year working on this project  (from initial project phase to system integration testing) and travelled couple of times outside India and between Hyderabad and Bangalore.  This application made me learn new things and helped me to connect to many people around the globe.

image

Related Articles


If you like this post, please click on our sponsor advertisement.


I joined Microsoft commerce server forums on July 30th 2008. Frequently I used to come to forums to see how users faces challenges in developing commerce server solutions. Initially, I used to answer user queries on CS2007 forum later I extended my contributions to CS2009 forums. Through forums, I got lot of information on how users are facing problems, their solutions and many times, they have make me think different on how best we can implement CS solution for this problem. I believe I have (at least tried) helped community members.

Today I have crossed 1000 posts in commerce community only. In past 27 months, I have replied 1000+ posts (on the average of one post per day) and out of that 428 posts are marked as answered for the problem, i.e, at the nearest, one post got answered for  every two posts.

image

Related Articles


If you like this post, please click on our sponsor advertisement.


After creating new site, when I try to open the website, I am getting very funny exception

System.ArgumentException: An attempt was made to create a second OrderContext object within an AppDomain where an OrderContext object has already been created using different connection strings or a different Commerce Server site name.  OrderContext is a singleton object so it is permissible to have only one instance created in a given AppDomain. —> System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: An attempt was made to create a second OrderContext object within an AppDomain where an OrderContext object has already been created using different connection strings or a different Commerce Server site name.  OrderContext is a singleton object so it is permissible to have only one instance created in a given AppDomain. —> System.ArgumentException: An attempt was made to create a second OrderContext object within an AppDomain where an OrderContext object has already been created using different connection strings or a different Commerce Server site name.  OrderContext is a singleton object so it is permissible to have only one instance created in a given AppDomain.
   at Microsoft.CommerceServer.Runtime.Orders.OrderContext.CompareConnectionStrings(String transactionResourceConnectionString, String transactionConfigResourceConnectionString)
   at Microsoft.CommerceServer.Runtime.Orders.OrderContext.Create(String transactionResourceConnectionString, String transactionConfigResourceConnectionString)

The exception is too long and I am pasting only 1/5th  of it Smile. As OrderContext is singleton object and for a single application domain only one Ordercontext is created. This is application constraint and we can’t do anything.

Mistake done: I copied existing web services (lazy to add my ID in all authorization stores using Azman tool) to new website but forgot to change the site name. Since two application pools web services are pointed to same site (different application pools), CS is throwing this exception. After changing the site name in new site web services, the application started working fine.

Related Articles


If you like this post, please click on our sponsor advertisement.


Follow me on Google+
Couldn't get data from google+
Sign up for Newsletter