Infrastructure and utilities breaking changes
Breaking changes to engine infrastructure, caching, serialization utilities, site context, and marketing APIs in Commerce Connect 15.
This article covers breaking changes to engine infrastructure, caching, serialization utilities, site context, marketing APIs, and other miscellaneous utilities in Commerce Connect 15.
Event configuration removal
Mediachase.Commerce.Engine.Events.EventCollection and EventDefinition have been removed. These configuration classes were marked obsolete since January 2019 and were no longer used by the commerce system.
Modern commerce applications should use standard .NET event handling or implement custom event infrastructure using dependency injection and service-based patterns.
CacheHelper obsolete methods removal
The following obsolete methods have been removed from Mediachase.Commerce.Engine.Caching.CacheHelper:
| Removed Method | Replacement |
|---|---|
Clear(string prefix) | Use IObjectInstanceCache |
RemoveByPattern(string pattern) | Use IObjectInstanceCache |
Remove(string key) | Use IObjectInstanceCache |
Insert(string key, object obj, TimeSpan timespan) (all overloads) | Use IObjectInstanceCache |
Get(string key) | Use IObjectInstanceCache |
The CreateCacheKey methods remain available.
// Before (Commerce 14) - CacheHelper static methods
CacheHelper.Insert("myKey", myObject, TimeSpan.FromMinutes(10));
var cached = CacheHelper.Get("myKey");
// After (Commerce 15) - IObjectInstanceCache via DI
public class MyService
{
private readonly IObjectInstanceCache _cache;
public MyService(IObjectInstanceCache cache)
{
_cache = cache;
}
public void CacheItem(string key, object value)
{
_cache.Insert(key, value, new CacheEvictionPolicy(TimeSpan.FromMinutes(10)));
}
public object GetItem(string key)
{
return _cache.Get(key);
}
}McXmlSerializer changes
The following overloads with extraTypes parameter have been removed from Mediachase.BusinessFoundation.Data.McXmlSerializer:
GetObject(Type type, string value, params Type[] extraTypes)GetObject<T>(string value, params Type[] extraTypes)GetObjectFromFile<T>(string path, params Type[] extraTypes)GetString<T>(T value, params Type[] extraTypes)SaveObjectToFile<T>(string path, T value, params Type[] extraTypes)
The extraTypes parameter was unused in the implementations. Use the corresponding overloads without extraTypes.
SiteContext constructor changes
Mediachase.Commerce.Core.SiteContext– The parameterless constructor has been removed. Use the constructor withIHttpContextAccessorparameter.Mediachase.Commerce.Core.DefaultSiteContext– The constructor withoutIHttpContextAccessorhas been removed. Use the constructor withICurrentMarket,IWebHostEnvironment, andIHttpContextAccessorparameters.
// Before (Commerce 14) - Parameterless constructor
var context = new SiteContext();
// After (Commerce 15) - Constructor with dependencies via DI
public class MyService
{
private readonly SiteContext _siteContext;
public MyService(SiteContext siteContext)
{
_siteContext = siteContext;
}
}Permissions.Reporting removal
Mediachase.Commerce.Permissions.Reporting property has been removed. This property was marked obsolete with the message "This member is no longer used."
SalesCampaign.TargetMarket removal
The EPiServer.Commerce.Marketing.SalesCampaign.TargetMarket property has been removed. This property was marked obsolete since July 2019. Use TargetMarkets (IList<string>) instead:
// Before (Commerce 14)
campaign.TargetMarket = "US";
// After (Commerce 15)
campaign.TargetMarkets = new List<string> { "US" };Money.DefaultCurrencyFunction removal
Mediachase.Commerce.Money.DefaultCurrencyFunction static property has been removed. The internal default currency function is still used internally but is no longer publicly accessible. Use ICurrentMarket or CommonSettingsManager to get the default currency:
// Before (Commerce 14)
var defaultCurrency = Money.DefaultCurrencyFunction();
// After (Commerce 15)
public class MyService
{
private readonly ICurrentMarket _currentMarket;
public MyService(ICurrentMarket currentMarket)
{
_currentMarket = currentMarket;
}
public Currency GetDefaultCurrency()
{
return _currentMarket.GetCurrentMarket().DefaultCurrency;
}
}StringExtensions removal
The following obsolete JavaScript encoding methods have been removed from EPiServer.Commerce.Extensions.StringExtensions:
JavascriptEncode(this string source)– Marked obsolete since October 2021.ToJavaScriptEncoded(this string source)– Marked obsolete since October 2021.
Use System.Text.Encodings.Web.JavaScriptEncoder or similar modern encoding APIs:
// Before (Commerce 14)
var encoded = myString.JavascriptEncode();
// After (Commerce 15)
var encoded = System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode(myString);Removed legacy projects
The following projects and assemblies have been completely removed from Commerce 15:
- Mediachase.BusinessFoundation – Legacy business foundation data layer.
- WebConsoleLib – Legacy web console library.
- Mediachase.FileUploader – Legacy file upload component.
OleDbIncomingDataParser removal
Mediachase.MetaDataPlus.Import.Parser.OleDbIncomingDataParser has been removed. This was the only part of Commerce that used OLE DB directly and was unused within the solution.
Web services catalog access removal
Accessing the catalog system via web services is no longer supported. This support and related code has been removed.
Legacy template and image engine removal
- The obsoleted Mediachase template engine has been removed.
- The obsoleted Mediachase image engine has been removed.
Updated 2 months ago
