Thursday, November 30, 2017

Connect with #Sitecore community through various channels







Now, Sitecore community is growing drastically, and I am proud to be a part of this wonderful community, yes this is our #Sitecore community.

There are various way to join this community through different channels, blogs, slack, stack exchange, Local Sitecore user group, market place, Sitecore documentation etc.. etc..

Here I have consolidated the different Sitecore networks website’s list which can help you to explore various channels, getting information, Sitecore documentation, Sitecore Market Place modules, MVP details, Sitecore user group information etc.



                         

Sitecore Community:
Get help from members of Sitecore community, including Sitecore employees, Certified Sitecore Developers, and MVPs. https://community.sitecore.net/

Sitecore documentation:
Access official Sitecore documentation for Sitecore Experience Platform and other Sitecore products.

Sitecore Market Place:
Discover and contribute to Sitecore community-driven modules, You can find different sitecore modules, If you have some common solution, you can create as a module and submit here.

Sitecore Slack Community Chat
Join the Sitecore slack channel, where you can find the quick response from the Sitecore members including Sitecore employees, MVPs.

How to join the channel:

Thanks, Akshay, Mike Reynolds and Johann Baziret for this amazing initiative.

Sitecore Stack Exchange
Sitecore Stack Exchange is a question and answer site for Sitecore users, aim to answering all the question regarding the Sitecore.

Thanks Mark Cassidy for such great initiative.

Sitecore User Group Site
Sitecore User Group Directory is dedicated to supporting the Sitecore communities wherever they exist across the globe.

Sitecore User Group Conference (SUGCON)
Best way to explore the different Sitecore world 😊 through this great Sitecore conference events which happens every year to discuss the latest Sitecore topics, we really making fun, learning, networking, discussing sitecore in this event.
Stay tune on http://www.sugcon.eu/

Sitecore Hackathon
Sitecore hackathon is a free online community driven event organized by Akshay Sura and supported by Sitecore.
You can participate in this event with team, find more details here:

Sitecore MVP Information
Find all the information related sitecore MVP, recommendation, nomination, list of existing sitecore MVP here

Sitecore Facebook Group:
Join the sitecore Facebook group, you can share the sitecore related blogs, Information, Event announcement etc.


Sitecore Support Help Desk:
Open a support ticket and get in touch with Sitecore Support representative. Available to Certified Sitecore Developers.

Sitecore User Voice:
Welcome to the Sitecore feedback and suggestions site! We love hearing from our customers. If you have suggestions for how we can improve any area of Sitecore, please share them with us here. While we can't respond to every suggestion, we are committed to reading every post.


Sitecore Habitat
Sitecore Habitat is a range of sites demonstrating the capabilities of the Sitecore, find the Sitecore habitat demo here:


Sitecore Profile
Find and create your profile here, here you can see all your contribution, certificate etc



I hope this strong #Sitecore networks will help you to explore the Sitecore community.









Saturday, November 4, 2017

Monitor your #Sitecore Azure Web Apps with #Dynatrace SaaS



Dynatrace is a pure APM Tool. It can not only monitor your application infrastructure and health, but could also intimate the deep diagnostic details required for troubleshooting bottlenecks using bytecode instrumentation.
Dynatrace provides customers an all-in-one performance monitoring solution that includes user experience management, app performance, and infrastructure monitoring with SaaS and managed deployment options. Dynatrace supports out-of-the-box integrations to the Azure platform and third-party technologies such as Docker, Mesosphere, and Pivotal, and automatically detects anomalies based on machine learning algorithms.

Dynatrace makes it simple to monitor and optimize your complex applications. Automatic discovery and baselining provides rich insights with zero-configuraiton needed out of the box. Patented PurePath technology traces 100% of all transactions across every tier. Dynatrace's exclusive PureStack TechnologyTM directly correlates guest and host infrastructure health to individual application transactions and end users in real-time. Dynatrace 3D Model Technology combines the transaction detail and infrastructure health information provided by PurePath and PureStack Technology respectively to provide a 3D topology model with the exact link between every transaction and its guest and host infrastructure.

Connect Dynatrace with your Sitecore web Apps:

Do you have a Dynatrace account? NO, not an issue, start with 15-day SAAS login trail
NO need to install any software and hardware it’s all in SAAS environment, just signup with free trail and monitor your Sitecore web apps with Dynatrace and explore the feature of it.


Create the free account with SaaS login if you don’t have the licence




Navigate to left manage option, under manage go to Deploy Dynatrace and click on PaaS Integration:



Generate the environment and Token ID:



Copy token and environment id,

All done from Dynatrace side, let’s go to Sitecore web apps on azure portal,

  1. Navigate to the Web apps you want to monitor in Dynatrace
  2. Go to app service under resource group
  3. Go to the application setting under setting options
  4. Go to app setting section
  5. Create 2 keys named DT_TENANT and DT_API_TOKEN
  6. Set the value of environment ID in DT_TENANT key and API ID in the Token ID key





Now go to extension option under the development tool and click the add button from the right window:






Choose the extension named Dynatrace one agent and accept the legal terms




Press ok to install the extension, it will take some time to install:



  
Dynatrace one agent has been installed on our sitecore web apps, now we can monitor the web apps through Dynatrace.

Once Dynatrace agent connect with the web apps, it will list down all the application which is connected through agent.

Now, login in the Dynatrace

Navigate to the monitor option on the left side and click on hosts, now we can able to see the Sitecore webapps host here:






Click on the host link and monitor all the property of the web apps like current CPU utilization and memory, etc..




Below are some screen shots of some interesting features to monitor your application in Dynatrace:

Azure Application Reports:








Smartscape topology:



Dashboard:




  
Below is the capability comparison between Dynatrace and Azure Application insights



Perfect partners with DevOps in mind”

Dynatrace is the market-leading AI-powered monitoring solution for operating large scale dynamic cloud systems. Dynatrace and Application Insights are perfect partners with DevOps in mind. Deliver high quality code. Innovate faster. Excel in customer satisfaction.




Dynatrace support:










I hope this article will give you some insight of Dynatrace and configure with Sitceore Azure Web Apps.

Happy Sitecoring and Dynatracing




Thursday, October 26, 2017

Where is the Log File in #Sitecore 9?




Everywhere, there is only one sound Sitee…ccc..oorr..eee  Sitecore.. Sitecore .. and Sitecore 9 Only..

As we all are very excited to start playing with sitecore9, Installation was not easy.

This time no “Next-Next” “Wizard Approach” to install the sitecore 9, if you still haven’t installed the Sitecore 9 yet, then….  “Go and install Man.” 😊

Here are some useful links which can help you to install sitecore9



I also just start playing with Sitecore9 and the question raised when I encountered the error while I tried to play with new sitecore9 form as below:



The moment I got this error, suddenly I thought about our life saver file “Sitecore log file”  and browsed the root directory of my installation for looking the data folder where Sitecore log file lives…   

 But now in sitecore 9 there is no data, database and website folder, everything directly contains in the root folder of the instance, and data folder files has been merged into the app_data folder as below:





So now if you are looking in to Sitecore log file browse the below directory:

C:\inetpub\wwwroot\ InstanceName\App_Data\logs instead of data folder.



Happy Sitecoring9 

Saturday, September 30, 2017

Unlock #Sitecore items from all language versions through UnLockItemVersions Module




Are you working with multi-lingual solution? And having multiple language version for the Sitecore Item which you want to unlock, what is the solution? Yes, you have to go one by one in each language version and unlock specific item version. Why we can’t unlock all the language versions of the Item by One Click?

We are working with 17 languages and unlock the version one by one is not only time consuming but also the nauseating job for the admin user.
Yes, I had the same requirement, to unlock the item with all language version by single click and also my client wanted to unlock all immediate child items as well in all language version.

So I provided the solution (UnLockItemVersions Module) with below functionality

  • User can unlock all the language version of Sitecore item by just one click
  • User can unlock all the language versions of the Sitecore item with immediate child as well by just one click, this is very practical scenario, for example I need to unlock all the articles in all language so, I can easily go to the article folder and click on All Version with Child option to unlock items.
  • Not only admin user can unlock the Item versions, any user who is been configured for this task can see this context menu option and use this feature, this is also the biggest challenge for sitecore content editors, As currently admin user can only unlock the other’s locked items.


Download the Module


How to Use this Module:
It’s very simple and straight forward, just install this module, it will add one DLL, path config file for custom command and one item in the context menu in the core database.


Just right click to the item which that you want to unlock with all version or All version with child option,

It will unlock from all the language version of the item.




Post installation

Once you installed this module you can see the new option in the context menu called Unlock Item with two sub items all version and All Version with Child:




Next step to provide the security rights of this feature for specific users, otherwise this option is visible for all users, so follow the below steps to provide the security rights:

  • Change the database from master to core
  • Go to security editor > Desktop > security tools > security editor
  • Go to unlock item option in the core database
  • /sitecore/content/Applications/Content Editor/Context Menues/Default/Unlock Item
  • Assign the read/write permission to the appropriate users/roles





How to use this Module:


Also there is one solution available in PowerShell by Richard Seal.


However, this module is more focus to unlock the items with language version and immediate child items.

I hope this article will help you to unlock the Sitecore item with versions.

If you have any questions or concerns, please get in touch with me on Twitter @sitecore_ashish or on Slack).

Happy Sitecoring



Sunday, August 6, 2017

Analyze your #Sitecore Media Library by MediaLibraryAnalyzer Module



Have you analyzed your Sitecore media library?

 
Not yet? This is the time to look your media library size, unused item etc.

Media library consumes more space in term of size and increase the volume of Items in sitecore tree, and over the period of time, it might have not used any more, thus we should clean up these Media library Items as these Items are not being used/referenced in any other content item in the Sitecore.

I got the same assignment, I had to clean up the media library in my project, so I analyzed the current media library folder and below is the summary:



I also wanted to capture the additional information when I ran the custom utility for Analysis my media library items,

  1. Media Item ID
  2. Media Item Name
  3. Media Item path
  4. Total Media Library Item Count
  5. Unused Media Library Count
  6. Uploaded Date
  7. Size of Individual Media Item

This information is really helping to my business user to analyzing the Media library data.

And also on the basis of this report, they can decide which Media item need to be delete or not?

In my case, below are the conditions for deleting the media library items
  • Media item must be unused means not referenced with any content item
  • Uploaded date should be older than 3 month 
  • Size of the media item should be more than 1MB


So,I have created one #Sitecore module called "MediaLibraryAnalyzer" which is responsible for the analyzing and cleanup of the media library.

Below are the functionalities of the MediaLibraryAnalyzer Module

  • Provides the user experience UI, where we can select the multiple input parameters, for example database name, Media Library Folder Path, Log File Path.
  • Provides the summary of the media library folder like Total media Item Count, Total Media Size, Total Unused Media Count, Total Unused Media Size, Total used Media Count, Total used Media Size
  • Provides the list of unused media item which contains various attributes like ItemName, Path, Media Type, Item Size, Created date, Modified date.
  • Filter the records based on created date to and from, media type, size 
  • Capability of archiving the unused Media Item, we can select the unused item and can move to a specific folder
  • Searching and paging the Media Item.


Below are the some Screen shot of the MediaLibraryAnalyzer Module

Summary of the media library




Filter the result based on several parameters



Move the un-used items to other folder:



Download the module:


How to use this Module:

  • Enter the URL your Sitecore instance name /Admin/MediaAnalyzer.aspx
  • Select the database where you need to run this utility
  • Enter the correct media folder path
  • Enter the Log file path for logging and make sure permission is being provided
  • Press on Go Button > 
  • All the un-used media item list will be listed
  • Click on Filter button >> further filter the result based on providing parameter like media type, size, created to and from the date.
  • Filter result will change in the text changed event
  • You can select multiple item and can perform 2 operation, whether delete it or move to another folder.
  • For delete the unused item, just select the items > press the Delete the selected item button


I hope this article will help you to analyze and cleanup the media library.

If you have any questions or concerns, please get in touch with me on Twitter @sitecore_ashish or on Slack).

Happy Sitecoring





Friday, July 7, 2017

Create Your Rest/Web API Architecture with ASP .Net Core 1.1 from Scratch




Today I came up with Web API solution with .Net Core 1.1 from scratch, in this Article/POC we will focus more on architectural pattern of the solution means how to organise your solution architecture of the Web API with different layer, I try to follow some of the key design principles/Architecture Pattern/technology as below

  • Separate of concern
  • Repository pattern
  • Dependency Injection Containers (IOC)
  • N-Tier Project Architecture
  • Entity Framework Core
  • .Net Core Web API




Below is the high-level architecture and data flow diagram of Web API.




I am going to use Visual Studio 2017 RC and IDE, but you can also use Visual Studio 2015 as IDE. If you don’t have the template for ASP.NET Core, you need to install this template
Let’s take an example of ABCSoftware Company which need to expose the API to provides the related software Product information like ProductName, Price, details etc.

   
I quickly created sample database and table using below script

create database ABCSoftware
use ABCSoftware


CREATE TABLE PRODUCT(PRODUCTID INTEGER NOT NULL PRIMARY KEY,CODE VARCHAR(5),NAME VARCHAR(100),UNITPRICE NUMERIC(6,2) NOT NULL);


INSERT INTO PRODUCT VALUES(10,'AB123','ORACLE',1000);
INSERT INTO PRODUCT VALUES(20,'AB456','E-commerce',200.25);
INSERT INTO PRODUCT VALUES(30,'AB789','Online marketing',250.60);
INSERT INTO PRODUCT VALUES(40,'PQ123','School management',399);
INSERT INTO PRODUCT VALUES(50,'PQ456','OfficeManagement Software',1050);
INSERT INTO PRODUCT VALUES(60,'PQ789','Inventory Management Softare',2250.99);






Create Visual Studio Project using .NetCore Web API

Open VS2017 > create .Net core Web Application using (.NetCore),
 NOTE: we can either create a .NET Core Web Application which targets .NET Core or a .NET Core Web Application which targets the full .Net Framework.
If you target .NET Core, then you can run the app anywhere that supports .NET Core (Linux, Mac, and Windows).
You will also have to stick to third party libraries that support Core and you won’t be able to use some stuff that exists in the full framework and hasn’t been included in Core.
Alternatively, you can target the full .Net Framework. You’ll be limited to Windows (for hosting) but can use any third party library and everything that exists in the framework.
So I am creating .NET Core Web Application which targets .NETCore




Then select the webAPI template using ASP.NET Core 1.1  as below



Rename the Project name from ABCSoftware to ABCSoftware.API as below



Add the Different  Project Layer in the solution
Go to the solution > Add the New Project > Class Library(.Net Core)



We need to create the below Project layers ( .NetCore Class Library projects) in the solution with above steps:

ABCSoftware.Data: This is Data layer which is responsible for all database related tasks. The purpose of this layer is the direct access to the database. It’s the only layer responsible for communicating with the database. If some other layer wants to access the database, then this will be done through some of the classes (repositories) we will define in this project. Also, we will create the Repository/ DBContext in this layer only.

ABCSoftware.Model: We will keep all of our domain objects in this library.

ABCSoftware.Service: This Layer is responsible for all the operation that need to expose in the MVC controller, all the Business Logic will go in this layer. This layer will directly be communicated to the Controller.

ABCSoftware.Configuration: This library is where we will keep all the configuration and the settings of the project.

After adding all the above the above library in the solution, our project will look like below:



ADD Model in the ABCSoftware.Model Project

Add a new class in the ABCSoftware.Model project named Product as below:



class Product
    {
        [Key]
        public int PRODUCTID { get; set; }
        public string CODE { get; set; }
        public string NAME { get; set; }
        public decimal UNITPRICE { get; set; }
    }


Preparing DATA layer

Adding connection string and setting up DbContext
Got to ABCSoftware.API project > appsetting.json and add the connection string named DBConnection here as below:





Now, Let's add base context class which will inherit from DbContext class
Go to the DemoSoftware.Data project > Add one class called DatabaseContext as below:



Oops, DbContext is not resolved, Yes, Now Time to install Entity Framework.

ADD Entity Framework Core reference from Nuget in Data Library Project.
To install the package, just right click on the project ABCSoftware.Data and then, select "Manage NuGet package". The below dialog of Nuget Package Manager will pop up. In the Browse tab, there is a search box. Type “Microsoft.EntityFrameworkCore.SqlServer” and just click on "Install" button to install.

Note: make sure you select latest stable version, 1.1.2 is currently compatible with ASP.NET core 1.1



Now check the DatabaseContext Class, and resolve the DbContext with using Microsoft.EntityFrameworkCore;





Add the below code in the DatabaseContext Class

public class DatabaseContext : DbContext
    {
        public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options)
        {

        }

        public DbSet<Product> Product { get; set; }
    }


           
Adding Repositories in The Data Layer

Create one Folder in the DemoSoftware.Data project called Repositories
Add one class in the Repositories folder called ProductRespository and one interface called IProductRespository in the Repositories folder by Right click > Add > New item > Class




Go to ABCSoftware.Data project >  Add the project reference of ABCSoftware.Model



Go to IProductRepository Interface and add the below code
List<Product> GetProductList();

Go to ProductRepository implementation class and add the below code:
class ProductRepository : IProductRepository
    {

        private DatabaseContext _DbContext;

        public ProductRepository(DatabaseContext Dbcontext)
        {
            _DbContext = Dbcontext;
        }
        public IEnumerable<Product> GetProductList()
        {
           return _DbContext.Product;
        }
    }





Now our data layer is completed, repositories have been created, let's create the service layer.

ADD Service layer

Go to the ABCSoftware.Service Project and Add Folder Called Services > Under this folder create one class called ProductService and IProductService Interface as below:



Add data and Model project reference in the service project as below:



Add the below code in the IProductService Interface as below:

   public  interface IProductService
    {
        IEnumerable<Product> GetAllProduct();
    }

And add the below code in the ProductService implementation class:
class ProductService : IProductService
    {
        private IProductRepository _productRepository;

        public ProductService(IProductRepository productRepository)
        {
            _productRepository = productRepository;
        }
        public IEnumerable<Product> GetAllProduct()
        {
            return _productRepository.GetProductList();
        }
    }



This Service layer will call the repository class in the data layer as the above code.

And IproductService exposed only one method called GetAllProduct() and will call by controller class.

ADD Controller method
Now go to the web project >  Right Click > and add one controller class called ProductController:









Add Minimal Dependency
Add API Controller:








Go to Productcontoller > and Add the below Code:
public class ProductController : Controller
    {


        private IProductService _productService;

        public ProductController(IProductService productService)
        {
            _productService = productService;
        }

        [HttpGet]
        public IEnumerable<Product> GetProductData()
        {
            return _productService.GetAllProduct();
        }
    }



Now, everything is done!! Let’s Execute the API to test..
OOPS, we didn’t resolve the Repository and service layer dependency, let's resolve this first:

Add Dependency Injection in the Solution

Go to ABCSoftware.Configuration Project > Add one class file called DependencyResolver

Add Microsoft.EntityFrameworkCore.SqlServer reference in the Project
Add Service and Repository Project reference in the Project



Below is the code of the class

public static class DependencyResolver
    {
       
        public static void RegisterDependency(IServiceCollection _ServiceCollection,string connectionString)
        {
            //adding DB Dependecy Injection
            _ServiceCollection.AddDbContext<DatabaseContext>(options => options.UseSqlServer(connectionString));

            //Adding repository DI
            _ServiceCollection.AddTransient<IProductRepository, ProductRepository>();

            //Adding Service DI
            _ServiceCollection.AddTransient<IProductService, ProductService>();
        }
    }



Now go to ABCSoftware.API Project > Add Project Reference > ABCSoftware.Configuration

Go to the Startup.cs class and add the below code in the ConfigureServices() Method
      var con = Configuration.GetConnectionString("DBConnection");
            DependencyResolver.RegisterDependency(services,con);





Now all dependency will resolve through the common function called  RegisterDependency from DependencyResolver Class, This is a Just example of SOC(Separation of Concern) and also no need to get reference of Data Project directly in the ABCSoftware.API Project.

Now Build the solution and Run the Site using local IIS Express( using F5)
Check the result localhost/api/Product
If you want to host this API on Windows Server IIS, follow the below link



Testing ASP.net core Web API (HTTP request) Using Postman.
Download the POSTMAN APP, https//www.getpostman.com/ 
After download and install the Postman, Just check the HTTP Request as below:



I hope this article will help you to understand the Web API concepts using .Net Core.
If you have any questions or concerns, please get in touch with me on Twitter @sitecore_ashish or on Slack).