EntryContentBase, MetaObject, CatalogEntryDto, Entry: which should you use?

It can be pretty confusing for new Commerce developers to understand how to work effectively with entries in Commerce. There are many things which represent the same concepts, however they are different and their APIs are not compatible. So which is which and what should you use?

Which is which

    • CatalogEntryDto is the DataSet to represent one or more entries (CatalogEntryDto can of course be empty). Beside the basic information like Name, Code, or MetaClassId, depends on how did you load it, a CatalogEntryDto can contain information about the assets, the associations or the variations (you can specify what to load by using CatalogEntryResponseGroup parameter. CatalogEntryDto, however, does not contain information of the metadata system of an entry – for example, if you add a metafield named “Description” to your entry metaclass – that is not available in a CatalogEntryDto.
      CatalogEntryDto can be loaded or saved by ICatalogSystem methods.

    Continue reading “EntryContentBase, MetaObject, CatalogEntryDto, Entry: which should you use?”

    Catalog Search APIs are for editing only!

    If you are using Catalog Search APIs for any customer-facing features, you are doing it wrong!

    I have seen this problem a couple of times – the search feature on the site is “dead” – it is very slow, and the log file is usually filled with dead lock or timeout error. As it turns out, the search feature was implemented by Catalog Search APIs, which is a big no-no.

    To be clear, there are two builtin APIs related to searching in Episerver Commerce: the “fast” one, which can be done via SearchManager, ISearchCriteria and ISearchResults, is the SearchProvider APIs. It’s the indexed search (strictly speaking, you can make it not “indexed”, but that’s beside the point), and the actual search functions will be provided by providers, like LuceneSearchProvider, Solr35SearchProvider, or FindSearchProvider.

    Continue reading “Catalog Search APIs are for editing only!”

    I was with the EMVPs, and that was a fantastic experience

    If there is anything I regret being an Episerver employee, is that I can’t be an EMVP – the gang of awesome Episerver developers which their contributions are widely recognized by the community (I don’t consider myself to be “awesome”, but I try (to be)). The EMVPs can be seen as the evangelists of Episerver frameworks and technologies, they spread their wisdom, experience and best practices to help developers build better solutions, and they give valuable feedback to us to build better frameworks.

    EMVP Summit is one of special treat Episerver gives to EMVPs, as a recognition for their contributions, and also a chance – directly than ever – for Episerver to listen to the feedback from their distinguish developers. As a software engineer in Commerce development team, I was sent to team up, to talk, to discuss and to socialize with the EMVP (after winning a small competition with my two teammates, and getting a grant from my wife 🙂 ).

    Continue reading “I was with the EMVPs, and that was a fantastic experience”

    Debug .NET memory dump with WinDBG – crash course. Part 1

    If you ask me what had I been doing the last two weeks – then the answer is I was pulling my hairs.  A customer had a problem with their site as the memory hiked up after catalog imports and stayed there “forever” – and in the end it slowed the site down. I jumped in and almost regretted that decision – had to spent days  messing around with WinDBG and memory dumps. In the end – I found the problem and it was fixed. A lot of hairs were loss in progress, but I learned something about WinDBG – and that’s what I’m sharing today.

    WinDBG is probably the most famous tool for debugging stuffs on Windows. Out of the box, it only works with native applications, aka assembly and such – but lucky for us, there are plenty of extensions to allow it to work with .NET application. The “standard” SOS and more advanced extension SOSEX. SOS is included in WinDBG, while you can download SOSEX from here (for 64 bit) or here (for 32 bit) . Download the zip file and extract the dll somewhere.

    WinDBG comes with the Windows SDK, not the standard .NET framework, so you’ll probably need to install it separately from here

    Continue reading “Debug .NET memory dump with WinDBG – crash course. Part 1”

    Why (and when) should you contact Episerver developer support service.

    Today I filed a bug, which I should have filed almost one year ago. I saw it several times, I even had solution for it, but I didn’t think/know it was a bug. It was reported here: http://world.episerver.com/forum/developer-forum/Problems-and-bugs/Thread-Container/2016/9/commerce-catalog-randomly-goes-empty-until-website-restart/  and here http://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2016/6/addstaticattributepropertyvalues-object-reference-exception/

    I’ve always wanted to say Episerver products are perfect frameworks and have no bugs at all. But that’s not true. Despite of having very talented developers and dedicated QAs, and a very high requirement for quality (“Quality is non-negotiable”), we still miss to catch some (very few) bugs.

    Continue reading “Why (and when) should you contact Episerver developer support service.”

    Episerver Commerce CustomerContact Events

    This post was inspired by this question: http://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2016/9/commerce-manager-contacts-events/

    and is an excerpt from my book: https://leanpub.com/proepiservercommerce

    You might notice the lacking of events in some parts of the system. We have events for catalog system, for order system, for prices and inventories changes, but that’s not enough. You might want to have events – or at least – the ability to know when something happens. For example, when a customer contact is changed, or edited, or deleted, it would be very nice to do some extra actions.
    Sending emails, updating external systems, etc.

    Such events are not available out-of-box, so we have to implement our own. How? We don’t have ICustomerContactService (or something similiar) interface where we can write our implementation to replace the default service (and even if there is, it would be a big task to do so). So there’s no “ordinary”, framework-way to do that. However, CustomerContact is built on Business Foundation system, and BF, at its core, is all above extensible and pluggable. We don’t have ICustomerContactService interface, but we have IPlugin
    who can do the same, and even more. As we learned in previous chapter, CustomerContact is just another EntityObject and all operations are still done via BusinessManager.Execute(Request) – even we have some nice wrapper methods to make working with it easier. And when Execute(Request) is called, it also runs all registered IPlugin modules.
    Continue reading “Episerver Commerce CustomerContact Events”

    The hidden danger of dot (Or why should your metafield not contain . in the name)

    A dot (.) – it is harmless. What harm can it do, it looks pretty innocent.

    And yet it can break your Catalog UI.

    Psyduck, from Pokemon Go
    A dot can look pretty harmless and innocent, just like a Psyduck. Frankly, its eyes are also two dots.

    Catalog UI relies on the Shell UI from CMS to render properties and such. Shell UI, in its hands, needs to know about the metadata of the properties. When you have dot in the metafield names, the MetaDataPropertyMapper will create an Property with that name on site start up. And then when you open All properties mode, Shell UI will request your content type models, and CMS Core will happily return those properties.

    Continue reading “The hidden danger of dot (Or why should your metafield not contain . in the name)”

    How to check if a coupon was successfully applied

    When a customer add a coupon to his/her cart, it’s nice and best practice to show to him/her if the coupon has been applied successfully, or if it was an invalid/not applicable code.

    Coupon has been applied successfully
    Coupon has been applied successfully

    How can you do that?

    In old promotion system

    When old promotion system run, each successfully applied promotion will be presented by an instance of Discount, which has a property named DiscountCode – this is the coupon used for the promotion (it can of course be null if the promotion requires no coupon).

    Continue reading “How to check if a coupon was successfully applied”

    Why did I leave HBO (Nordics). Spoiler: it sucks!

    As most of us, I spend a fair chunk amount of my free time to watch movies and TV series, and as most of us, on Netflix. While Netflix has some very good content, and they have been adding great original TV series (House of Cards, Daredevil, Stranger Things, Narcos, just to name a few), those have not been enough for me. I want to watch Games of Throne, The Wire, The Sopranos, Silicon Valley etc, but sadly, they are pretty HBO-exclusive, so to watch them, I have two options: either buy the discs (Very expensive), or subscribe to HBO (much cheaper).

    Fine, I decided to suspend my Netflix for a month a resume my HBO Nordics subscription. At least for one month to watch the good content there. Last year I did try HBO one month, for free, but I cancelled it – which I have no clear memory why I did. May be it will work this time.

    Unfortunately it does not.

    Right after I tried HBO again, it’s clear to me why I left HBO at the first place – and sadly, there are several reasons for that.

    Continue reading “Why did I leave HBO (Nordics). Spoiler: it sucks!”