So, last week I read an article about Sitecore Upgradation by Martin Miles. In that article, at Upgrade Database step, it was mentioned that the default items in sitecore from 10.1 and above, are not stored in database and are read from file system.
10.1 was released almost a year ago and although I am working on a 10.1 instance I missed this information somehow. But it got me curious and I immediately checked the web root folder to see the file. The physical files are present under,
{webroot}/App_Data/items/core/items.core.dat
{webroot}/App_Data/items/master/items.master.dat
{webroot}/App_Data/items/web/items.web.dat


Prior to 10.1 there were no such folder called items under App_Data (Sitecore 10-App_Data folder below)

So, yes…..we have located the file. Now let’s open it and see the system defaults and get this over with and start my weekend!
But my stars had other plans it seems, When opened that dat file in notepad was surprised to see the defaults as below,

I missed the idea that it would have been encoded somehow. But I was not convinced yet, so to confirm that default items are not present in sql master db, I checked the database table itself.

Comparing it with a DB from 9.3

The few records which you see in 10.2 master database must be from my custom changes. Yes, the default items are not present in the database. But I’m still not convinced. I want to see the data inside items.master.dat file. So I explored deeper.
After some browsing, I was redirected to the Sitecore.config file.
Sitecore 10.2 Sitecore.config and……Voila!

The dataproviders and protobufitems are specified here.
When checked in Sitecore 10 sitecore.config no such values were specified.

Now there is this new terminology – Protobuf (well..at least for me it was). So as I said earlier, the sitecore default items are stored as dat physical file right, Protobuf is a google based serializer. So the default items are serialized using Protobuf and are shipped as file system.
So now, if we deserialize the dat file, we’ll be able to see the actual data. I started looking for various online protobuf serializers and to my luck, I didn’t find any. At the same time I was still curious and somehow wanted to see the data in the items.master.dat file.
So, I decided to see some .net code snippets for deserializing using protobuf package. So I came across this article, which made it pretty much straight forward. Read the file system, Serializer.Deserialize that’s it.

Created a simple .NET Console Application, Added the required nuget package,

When I actually wrote the code, the type <T>????
Then I remembered, that I had installed JustDecompile long back and based on the values specified in the sitecore.config – Database section – Sitecore.Data.DataProviders.CompositeDataProvider, Sitecore.Kernel; Sitecore.Data.DataProviders.ReadOnly.Protobuf.ProtobufDataProvider, Sitecore.Kernel; decided to decompile the kernel dll and see how they’ve handled it.

While loading these dlls, it asked for the dependency dll – Sitecore.Data.ResourceItems.ProtobufNet

After going through these dlls, realized that, the data is serialized as ItemsData using Protobuf. So to deserialize it, added this dlls reference to my application and …..


Now I’m convinced. 🙂
So, the reason for this change is that, it creates a separation between default items and our custom content changes thereby enabling upgradation process easier. Meaning, when we upgrade the sitecore instance, just these files have to be updated.