I should add the problem occurs in a webservice using latest MediaChase dlls so I'm guessing it it a configuration issue with regard to the EPiServer.ServiceLocation finding a concrete runtime instance for the IPriceService.
PluginFamily Mediachase.Commerce.Pricing.IPriceService
Activation error occurred while trying to get instance of type IPriceService, key ""
{"StructureMap Exception Code: 202\nNo Default Instance defined for PluginFamily Mediachase.Commerce.Pricing.IPriceService, Mediachase.Commerce, Version=7.0.243.0, Culture=neutral, PublicKeyToken=6e58b501b34abce3"}
Ok, figured this out... this is now needed in web service global.asax:
protected void Application_Start(object sender, EventArgs e)
{
var container = new StructureMap.Container(); var locator = new EPiServer.ServiceLocation.StructureMapServiceLocator(container); var context = new EPiServer.ServiceLocation.ServiceConfigurationContext(HostType.WebApplication, container); new Mediachase.Commerce.Initialization.CommerceInitialization().ConfigureContainer(context); EPiServer.ServiceLocation.ServiceLocator.SetLocator(locator); }
Thanks, this was exactly what was needed to keep running console application(service) that was migrated from EPiServer Commerce R2 to EPiServer Commerce R3.
In CM R3 the RecursiveAssociations Response group fails to populate both Inventory and Variation Rows.
The scant documentation suggests this has replaced the CatalogEntryFull approach to hydrating these rows.
http://world.episerver.com/Articles/Items/Catalog-Entry-loading-and-ResponseGroups-in-EPiServer-Commerce/
Even though the row exists a row count of zero in both cases and consequently a save operation attempts to create a new row which results in a primary key violation on inventory & variation tables.
What is the correct way to return a Catalogue Entry Dto with fully populated variation and inventory rows?
var responseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.RecursiveAssociations);
CatalogEntryDto entryDto = CatalogContext.Current.GetCatalogEntryDto(entryCode, responseGroup);
No Variation or Inventory Rows returned using above.
var responseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull);
CatalogEntryDto entryDto = CatalogContext.Current.GetCatalogEntryDto(entryCode, responseGroup);
CatalogEntryFull returns this error: "No Default Instance defined for PluginFamily Mediachase.Commerce.Pricing.IPriceService"
Public enum ResponseGroup
{
Assets = 32,
Associations = 8,
CatalogEntryFull = 4, (Changed in R3 to only return one level in the hierarchy)
CatalogEntryInfo = 2,
Children = 16,
Nodes = 64,
Request = 1
Variations = 128 (R2 SP2)
Inventory = 256 (R2 SP2)
RecursiveAssociations = 512 (R3, behaviour like the R2 SP2 Full RG.)
}