Interview Cheat Sheet

 


Sitecore 8.2 upgrade to 10

  1. Create Sitecore packages from Sitecore 8.2 web applications. Creating the packages separately for Templates, Media, Renderings. Dictionary and Content.
  2. Installing Vanilla Sitecore 10 instance.
  3. Take a backup of Master DB and website folder of Sitecore 10 instance.
  4. Install the Sitecore packages on the new Sitecore instance.
  5. Take the backup of Visual Studio solution for Sitecore 8.2
  6. Remove the references (physical files or NuGet packages) of Sitecore.Kernel, Sitecore.Mvc and any other dll used.
  7. Change the target framework of the Project from 4.6.2 to 4.8 in the properties.
  8. Add the Sitecore.Kernel, Sitecore.Mvc and any other references using NuGet Packages required for Sitecore 10 version.
  9. Build the Solution.
  10. Publish it on the new instance website folder.
Sitecore.Kernel.dll
Sitecore.Web.dll
Sitecore.Content.dll
Sitecore.Analytics.dll
Sitecore.Experience.Services.dll

A few common changes can be:

  1. Changes in Core DB.
  2. Custom config file created but not a part of Visual Studio solution.
  3. Changes are done directly in the default config files.
  4. Custom Core created in Search.
  5. Third-party integrations.
  6. Any endpoint stored in Sitecore needs to be updated manually.

Diff btw Sitecore 8 vs. 9

  • In Sitecore versions 7.5 to 8.2, MongoDB was required for  xDB architecture
    • In Sitecore 9-SQL Server 2016 and SQL Azure.
  • Sitecore 9 external providers can be used to validate credentials using ADFS
    • Sitecore.Owin.Authentication.Enabler.config.example
    • using Federated Authentication functionality, and Sitecore Identity server.
  • Sitecore Commerce was introduced in Sitecore 8.2.
  • SXA Is Now Built-In in Sitecore 9-SXA is now included with the Sitecore 9 platform.
  • Sitecore9 Forms- previously WFFM forms.
  • Version9-we are now given the tools to be GDPR and PII (Personally_identifiable_information)compliant.
  • Dynamic placeholders -as part of the product.
  • Sitecore9- PowerShell-based installer, previously exe or zip-based.
  • version9-Cloud Deployment Enhancements.
    • Experience Cloud feature-option of having their entire deployment(s) stored, managed, and secured via the cloud (through Azure PaaS).
  • Sitecore 8 was compatible with the .NET Framework, while Sitecore 9 moved towards .NET Core.
  • Sitecore 9 introduced Sitecore Horizon, a user-friendly content editing interface that replaced the older Experience Editor.
  • xConnect was introduced in Sitecore 9.
    • In Sitecore 8, data collection, processing, and tracking were primarily handled by the MongoDB-based Experience Database (xDB).
    • xConnect, which is a separate service and API framework for collecting and processing data, was a significant architectural change introduced in Sitecore 9 to replace the xDB. 
  • Headless CMS: Sitecore 9 supports headless CMS, which means that the content can be decoupled from the presentation layer. This makes it possible to deliver content to different devices and channels, such as mobile apps, wearables, and IoT devices.
Sitecore 10 does not support the .NET Framework. Sitecore 10 is a .NET Core-based platform
Sitecore versionSupported .NET versions
Sitecore 10.NET Core 3.1 and later
Sitecore 9.NET Core 3.1 and later
Sitecore 8.2.NET Framework 4.6.2 and later
Sitecore 8.1.NET Framework 4.6 and later
Sitecore 8.NET Framework 4.5 and later

Sitecore PaaS stands for "Sitecore Platform as a Service." It refers to a cloud-based hosting and deployment model for the Sitecore Experience Platform

----------Create custom facets to store other contact information.-------------
  • Class must inherit from Sitecore.xConnect.Facet class
step1: Create a Custom Facet Model


Step2: 
Register the Custom Facet Model:



 


step3: Deploy custom Facet model to XDB 
serialize your model in JSON format


On execution of the console application, it will generate a JSON file at bin/Release folder. Copy that JSON file and paste at the below places:
  • <x-connect root path>\App_data\Models
  • <x-connectroot path>\App_data\jobs\continuous\IndexWorker\App_data\Models

Now deploy your Custom facet class project dll at the following places:

  • <Instance_Name>.xconnect\App_data\jobs\continuous\AutomationEngine\
  • <Instance_Name>.xconnect\App_data\jobs\continuous\IndexWorker\
  • <Instance_Name>.xconnect\bin
  • <Instance_Name>.sc\bin
step4: Add Custom Facet Model to Configuration





Now your Custom facet is ready for use

Configure Azure Blob Storage

Create an Azure Blob Storage in your solution.
go into Azure portal. Click New and choose Storage Account.
create a storage container.

Add config file to your solution

Create a file Feature.FormsExtentions.AzureStorageProvider.config and add it in your website folder under App_Config/Environment.

fileUploadStorageProvider type="Feature.FormsExtensions.Business.FileUpload.AzureBlobStorageFileUploadStorageProvider, Feature.FormsExtensions">
  1. Add the following connection string to the App_Config\ConnectionStrings.config file of the Sitecore web application.
  2. <add name="azureblob" connectionString="DefaultEndpointsProtocol=https;AccountName=myblobtestazure;AccountKey={KEY};EndpointSuffix=core.windows.net"/>
  3. Enter the name you have chosen for your container in the blobcontainer part of the configuration.

=========HTML5 Geolocation=========




=========================



API with SITECORE

[HTTPPOST]


[HTTPGET]


===========SITECORE PIPELINE VS EVENTS================
Pipelines:
Example:

preprocessRequest 
hasPresentation
httpRequestBegin
renderField
httpRequestProcessed
httpRequestEnd
renderLayout

<httpRequestBegin>
        <processor
</httpRequestBegin>
public class NewsArticleLogEntryProcessor : HttpRequestProcessor




Handlers Subscribe to the events .. Events are raised .. handlers are called.


Creating a custom event:



REMOTE EVENTS:



Commands:
<command name="item:archiveitem" type="Sitecore.Shell.Framework.Commands.Archive,Sitecore.Kernel"/>
<command name="item:checkout" type="Sitecore.Shell.Framework.Commands.CheckOut,Sitecore.Kernel"/>
<command name="item:create" type="Sitecore.Shell.Framework.Commands.Create,Sitecore.Kernel"/>
<command name="item:delete" type="Sitecore.Shell.Framework.Commands.Delete,Sitecore.Kernel"/>
<command name="item:unbucket"
<command name="item:bucket"

======================================
Sitecore Custom Field:





============================================
Compatible renderings:




=============================================

Sitecore Custom Tokens

Already existing tokens :

  • $name – Name of the item
  • $date – Current server date
  • $time – Current server time
  • $now – Current server date time
  • $id – Item ID
  • $parentid – Item’s Parent ID
  • $parentname – Item’s Parent Name

Step 1 – Creating a custom ExpandInitialFieldValueProcessor

Create a custom ExpandInitialFieldValueProcessor with the following code.

namespace Sandbox.Processors
{
    using Sitecore.Pipelines.ExpandInitialFieldValue;
 
    public class TokenNextProcessor : ExpandInitialFieldValueProcessor
    {
        public override void Process(ExpandInitialFieldValueArgs args)
        {
            if (args.SourceField.Value.Contains("$next"))
            {
                if (args.TargetItem != null && args.TargetItem.Parent != null && args.TargetItem.Children != null)
                {
                    args.Result = args.Result.Replace("$next", args.TargetItem.Parent.Children.Count.ToString());
                }
                else
                {
                    args.Result = args.Result.Replace("$next", "0");
                }
            }
        }
    }
}

If the parent is not null and there are children
the value is set to the children`s count (the processor is executed after the child is added so the index will be 1 based),
otherwise, it sets the value to 0.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <expandInitialFieldValue>
        <processor type="Sandbox.Processors.TokenNextProcessor , Sandbox"
patch:after="processor[@type='type=Sitecore.Pipelines.ExpandInitialFieldValue.ReplaceVariables, Sitecore.Kernel']"/>
      </expandInitialFieldValue>
    </pipelines>
  </sitecore>
</configuration>


---------------------------------------------------------------------

==============================================

Create a dynamic URL with a wildcard item



==================================================

Create a new Button on Ribbon:

GoTo Core Database

/sitecore/content/Applications/Content Editor/Ribbons








/sitecore/content/Applications/Content Editor/Ribbons/Chunks/Navigate/Back



<commands patch:source="Sitecore.Commands.config">
<command name="contenteditor:back"

Creating a custom submit action

  • Create a submit action class

create a class that inherits from the SubmitActionBase<TParametersData> class.
public class LogSubmit : SubmitActionBase<string> {
protected override bool Execute(string data, FormSubmitContext formSubmitContext)}
  • Create a submit action item

  1. Go to /sitecore/System/Settings/Forms.

  2. Go to the item you just created and in the Settings section, in the Model Type field, set the value to the class type name.

Versioning of an item is controlled in three ways:

  1. Versioned fields
  2. Unversioned fields and
  3. Shared fields
Versioned fields:
By default all the fields are versioned.
The field value will be different across different numbered versions and different language versions as well.
Unversioned fields:
value is the same for all the numbered versions of a specific language.
Shared fields:
value doesn’t change across languages and the number versions.

Create a custom personalization rule

Step 1- First step is to create a new tag for our Custom rule under “/sitecore/system/Settings/Rules/Definitions/Tags”


Step 2:    Go to the path “ /sitecore/system/Settings/Rules/Conditional Renderings 


Step 3- Next- create custom Element and personalization condition under “/sitecore/system/Settings/Rules/Definitions/Elements”



custom-personalization-snippet

 
-----==----------=====---------=====-------------====---------------=====-----------=====---=====

Design patterns:






----------------------------------------------------------------------

Sitecore Helix


  • Pattern practice and standard
  • loosely coupled components
  • downward dependency
  • The Foundation layer -contains more abstract code and Interfaces.
            • -it supplies elements that are common to multiple features


  • Build and Deployment process:

     

    First Foundation modules, then Feature modules and then project.







  • Project-> layout.cshtml, placeholder, Any website or page-specific CSS JS, inversion of control or pipeline patterns
  • Feature->navigation, hero banner, accordion, login

    Foundation-> helper class, multi-sites, common utility, Sitecore platform, .NET, and other technology frameworks such as Bootstrap, Foundation, jQuery, etc

Configure federated authentication

let users log in to Sitecore through an external provider

Configure an identity provider:

Authorize access to web applications using OpenID Connect and Azure Active Directory describes how Azure AD works.
patches the FederatedAuthentication.Enabled setting by setting it to true.


etc..

SQL Stored Procedure:

Memory Optimization in DB:
Optimizing queries
Eliminating unused objects
Using indexes
Using memory-optimized tables
Using partitioning and Compression


-----------------------------------------------------------------------------

GlassMapper v4 



:IGlassBase

·         Glass.Mapper.Sc.{Version}

·         Glass.Mapper.Sc.{Version}.Mvc

·         Glass.Mapper.Sc.{Version}.Core


A REST Webservice With C# 

API authentication

process of verifying the identity of a user or system that is accessing an API
Basic authentication: Username and password
Digest authentication: hashed username and password
OAuth 2.0: use tokens
JSON Web Token (JWT): used in conjunction with OAuth 2.0.


Anti-forgery Token in ASP.NET MVC.
use Antiforgery Token with the help of @Html.AntiForgeryToken() in view  and [ValidateAntiForgeryToken()] on actionmethod.




Sitecore Validations









------------------------------------------------
UNICORN serialization


-----------------------------------------------

Sitecore Cache

-----------------------------------------------

Link manager Sitecore

--------------------SOLR Search---------------------------

Enable a Solr search provider in Sitecore in Web.config:

<add key="search:define" value="Solr" />

In Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config
    <setting name="ContentSearch.Provider" value="Solr" /> 
In Sitecore.ContentSearch.config 
    <setting name="ContentSearch.SearchMaxResults" value="500" />

Solr search index API::

Custom Solr Index:SITECORE INDEX: Creating a custom SOLR index

Types of Templates in Sitecore:

  • Data Templates: normal
  • Branch Templates:
  • Command Templates:


  • Standard Templates: define the display name, layout details, publishing restrictions and workflow, etc. on the items
Parameter Templates: 

/sitecore/templates/System/Layout/Rendering Parameters/Standard Rendering Parameters


Clone vs Copy :
In Sitecore, a clone is an item that is not just a copy of the original item, but one that inherits the field values from the original item. If you update a field in the original item, the corresponding field in the clone is also updated.

-----------------------------------------------

Performance:

Indexing Strategy:

Image optimization

Caching

GetDescendants

No of Items under one node

Sitecore Admin Cache page:

Jmeter

Sitecore Pipeline Profiler:

Event Queue Statistics:

-----------------------------------------------

MVC Routes

Configure multiple managed websites

website corresponds to the <site name="website"…/> definition in the Sitecore.config file.
  • Site 1 => rootItem="sitecore/content/site1" startItem="Home" ...

  • Site 2 => rootItem="sitecore/content/site2" startItem="Home" ...

virtualFolder 
physicalFolder 
<site name="test" hostName="mysite.com" virtualFolder="/virtual"

Multilingual in Sitecore:


-------------------------------------------------------------

Autofac DI and IOC container

Example:
  • InstancePerDependency()
Configure the component so that every dependent component or call to Resolve()
gets a new, unique instance (default).

builder.RegisterType<BlogSearcher>().As<IBlogSearcher>().InstancePerDependency();

  • SingleInstance()
Configure the component so that every dependent component or call to Resolve()
gets the same, shared instance.

builder.RegisterType<BlogSearcher>().As<IBlogSearcher>().SingleInstance();

  • InstancePerLifetimeScope()
Configure the component so that every dependent component or call to Resolve()
within a single ILifetimeScope gets the same, shared instance. 

Dependent components in different lifetime scopes will get different instances.

builder.RegisterType<MvcContext>().As<IMvcContext>().AsSelf().InstancePerLifetimeScope();

  • InstancePerRequest()
Share one instance of the component within the context of a single web/HTTP/API
request. 

Only available for integration that supports per-request dependencies
(e.g., MVC, Web API, web forms, etc.).

builder.RegisterType<Glass.Mapper.Sc.Web.RequestContext>().As<Glass.Mapper.Sc.Web.IRequestContext>().AsSelf().InstancePerRequest();



Modularity feature:



SOLID Principles 


O


Liskov Substitution Principle

Interface Segregation Principle (ISP)

DIP

 Dependency Inversion Principle definition“a high-level module should not depend on low-level modules. Both should depend on the abstraction”.

Dependency Inversion Principle states that “Abstractions should not depend on details. Details should depend on abstractions”.


Abstraction and encapsulation

Abstraction is a process concept. 
It is the act of identifying the relevant qualities and behaviors an object should possess. 
Encapsulation (implementation) is the mechanism by which the abstraction is implemented.

Singleton vs Static

  1. Singleton classes follow the OOP (object-oriented principles), static classes do not.
  2. We can implement an interface with a Singleton class, but a class's static methods (or e.g. a C# static class) cannot.

Readonly and const keyword in C#


the const keyword is used to declare constant fields and constant local. The value of the constant field is the same throughout the program 

readonly keyword to declare a read-only variable. This read-only keyword shows that you can assign the variable only when you declare a variable or in a constructor of the same class in which it is declared.

Comments