Views: 3484
Number of votes: 0
Average rating:

Upgrade to EPiServer Commerce 7.10.1 (ECRP)

It was not a smooth upgrade for me, this blog is to share and summarize my experience. I have multiple issues especially in data migration and accessing Commerce e manager after upgrade.

Error in update-epidatabse

System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near 'MERGE'. You may need to set the compatibility level of the current database to a higher value to enable this feature.

Fixes:
Option 1: Error occurs If you are working in SQL Server 2012 database and it is runnning with compability level "SQL Server 2005". You can change the compability level for your database by rightclick on the database in SQL Server Managment Studio, select Properties, select Options and then there is a dropdown Compability Level.

Option 2:
1 – Export SQL Changes using package manager console PM>Export-EPiUpdates
2 - Console manager will show you a path
3 - Edit/Correct Script File 7.10.0.sql
4 - run update.bat in command mode, (Process is defined http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/75/Deployment/Updating-EPiServer-via-NuGet/)

Data Migration Issues:

Custom Blobs: We are using a custom blob provider to upload images on Cloudinary. Folder/File names are based on Blob ID. Images were not available after upgarde because probably probably Guids for same blob source have been updated and in result got 404. I will be thankful if EPiServer can investigate this further and recommend some solution. Further if this is case please avoid these type of conversions whereever possible. as it can be a big issue In Live Enviornments or if we have 2000 products asserts.
Fixe: Uploaded all images manually in CMS Edit mode.


Data Migration can fail due to any reason specific to your data. That needs a fix before upgrade but to fix it you need to know the issue that can be logged with below code. After upgrade Site will redirect to data migration screen every time it needs to turn off to fix the errors. After fixing the data issue, remove comments from the web.config and run the data migration again or you will not be able to login in Commerce Manager without upgrade.

How to turn off Migration screen:

Comment this line from web.config
<add name="MigrationInitializationModule" preCondition="managedHandler" type="EPiServer.Commerce.Internal.Migration.MigrationInitializationModule, EPiServer.Commerce.Internal.Migration" />

How to Log the data issues:

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Commerce.Catalog.Linking;
using EPiServer.Core;
using EPiServer.Framework;
using log4net;
using Mediachase.Commerce.Catalog;
using Mediachase.Commerce.Catalog.Objects;namespace EPiServer.Commerce.Sample
{
[ModuleDependency(typeof(Initialization.InitializationModule))]
public class ErrorLoggerInitializationModule : IInitializableModule
{
private static readonly ILog _log = LogManager.GetLogger(typeof(ErrorLoggerInitializationModule));public void Initialize(Framework.Initialization.InitializationEngine context)
{
var referenceConverter = context.Locate.Advanced.GetInstance<ReferenceConverter>();
var contentLoader = context.Locate.Advanced.GetInstance<IContentLoader>();
var linksRepository = context.Locate.Advanced.GetInstance<ILinksRepository>();ValidateChildren(referenceConverter.GetRootLink(), contentLoader, linksRepository);
}private void ValidateChildren(ContentReference contentLink, IContentLoader contentLoader, ILinksRepository linksRepository)
{
IContent content;
if (!contentLoader.TryGet(contentLink, out content))
{
return;
}foreach (var property in content.Property)
{
try
{
// Validates isNull for the property.
var isNull = property.IsNull;if (_log.IsInfoEnabled)
{
_log.InfoFormat(CultureInfo.CurrentCulture,
"Property '{0}' for content '{1}' with id '{2}' can check it's null value.", property.Name,
content.Name, content.ContentLink.ID);
}
}
catch (OutOfMemoryException)
{
throw;
}
catch (Exception exception)
{
if (_log.IsErrorEnabled)
{
_log.ErrorFormat(CultureInfo.CurrentCulture,
"Property '{0}' for content '{1}' with id '{2}' contains the following error '{3}'.", property.Name,
content.Name, content.ContentLink.ID, exception.Message);
}
}
}var children = contentLoader.GetChildren<IContent>(contentLink);
foreach (var child in children)
{
ValidateChildren(child.ContentLink, contentLoader, linksRepository);
}if (content is NodeContent || content is EntryContentBase)
{
var links =
linksRepository.GetRelationsBySource(contentLink).OfType<ProductVariation>().Select(x => x.Target);
foreach (var linkReference in links)
{
ValidateChildren(linkReference, contentLoader, linksRepository);
}
}
}public void Preload(string[] parameters)
{}public void Uninitialize(Framework.Initialization.InitializationEngine context)
{}
}
}



Other related resources on upgrade topics are
http://world.episerver.com/Blogs/K-Khan-/Dates/2014/7/EPiServer-Commerce-Upgrade-strategy-in-light-of-ECRP/

http://world.episerver.com/Blogs/Richly/Dates/2014/8/For-Those-Who-Had-Issues-Updating-to-Commerce-710/

http://world.episerver.com/Forum/Developer-forum/-EPiServer-75-CMS/Thread-Container/2014/7/Error-in-update-epidatabse/?pageIndex=2

Aug 06, 2014

jonas.bergqvist
(By jonas.bergqvist, 8/11/2014 1:12:43 PM)

Could you share the code you have for your blob provider? I made a simple test and didn't get any problems, but I probobly missed something.

K Khan
(By K Khan , 8/11/2014 1:23:34 PM)

Please check your email

K Khan
(By K Khan , 8/26/2014 5:31:23 PM)

Updates - We can't replicate the blob related issue.
/K

Please login to comment.