Blog Categories

Subscribe to RSS feed


Follow Microsoft Technologies on Pinterest

Archive for the ‘.NET’ Category

Sitecore Glass.Mapper: Concrete Classes vs Interface Mapping

glass mapperGlass.Mapper is a great object-relational mapping (ORM) tool built on .NET for the Umbraco and Sitecore platforms. As a Sitecore Platinum Implementation Partner, Perficient and its developers use the best tools available, and Glass.Mapper is right up there in our preferred Sitecore tool belt.

As a Sitecore developer interested in using Glass.Mapper, you should consider one important architectural decision that can really impact ease of development and long-term maintenance of your project: should you write C# interfaces or concrete classes to represent Sitecore data?

The Basics: Templates to Objects

At its most basic, Glass.Mapper maps a Sitecore template to a strongly-typed C# object – very POCO friendly. Template fields are exposed as read/write properties, and distinct classes allow for easy testing. This allows you to quickly mirror your templates in code and have easy access to your content fields.

Best of all, Sitecore’s multiple template inheritance can be easily represented via Glass.Mapper, but here’s the catch: C# does not allow multiple inheritance for concrete classes, but does support the concept via interfaces. With this in mind, is there a best practice for designing classes/interfaces with Glass.Mapper? Let’s take a quick look at both options.

Concrete Classes

While concrete classes lack multiple inheritance, they do support base classes, which can be useful for modelling Sitecore’s basic item fields (ID, ItemName, DisplayName, Path, etc.) on a base class, then extending that with a template definition as necessary. This also lets you add methods directly on the classes, which helps consolidate business logic and simplify discovery of functionality.

Because inheritance options are limited, concrete classes work best for content with simple structures and limited repeatability – in other words, a site with a small number of Sitecore templates or those with overall simple structures.


Because interfaces can be inherited multiple times, Sitecore items with multiple templates are a natural fit.

In my experience, this works best when you keep data modelling simple: use interfaces to model Sitecore templates as if you were building simple POCOs. Start by creating an interface based on each of your templates (including necessary inheritance from other templates), then let Glass.Mapper do the heavy lifting of mapping across all said interfaces. Don’t try to implement concrete classes and extend logic or add custom fields/properties. Just read/write data from Sitecore and use helper classes or extension methods to add functionality around your models.

Previous versions used the Castle Windsor IOC library to generate proxy objects, but the new-for-2015 Version 4 uses the factory pattern to accomplish the same thing.

For additional information on interface implementation with Glass.Mapper, refer to this documentation.

Choose Wisely

Glass.Mapper works best when your data modelling is kept simple: use C# interfaces to model Sitecore templates. Only consider concrete classes for simple data structures and small websites. If you want to mix-and-match, you can define interfaces and implement concrete classes farther down the inheritance tree, but remember that you will have to implement methods and members for all inherited interfaces – which negates the simplicity of Glass.Mapper quite a bit.

Ignite 2015 Recap – Top 3 Sessions to Replay

ignite mainWelcome back from a great Ignite Conference! By now, I hope everyone knows that the conference recordings are posted to channel9, a section of MSDN. Microsoft does a great job of recording and publishing all of this content quickly, its pretty awesome.

One of my biggest challenges at the conference was knowing which session to pick. There were 3-6 sessions at any given time that I wanted to go to. All week it was like that, crazy.

This year, Microsoft added “foundational keynote” sessions. Sadly, most of them were on Monday and over-lapped each other. I went back and downloaded the videos and they are all amazing, filled with product name changes, roadmap discussions, and a very transparent look at Microsoft’s Cloud Strategy. Read the rest of this post »

Ignite 2015 – DevOps Strategy, Visual Studio Online Announcements

ignite mainFor my first session at Microsoft Ignite Conference 2015, I chose DevOps as a Strategy for Business Agility by Brian Harry, Microsoft Technical Fellow and he serves as the Product Unit Manager for Microsoft Team Foundation Server. I must say, it was a great choice.

Brian kicked off this amazing session with only a few, very short slides, explaining the benefits of DevOps and apologizing that the title was not completely accurate. Brian did discuss the strategy and why DevOps is extremely important, however he understood his audience was much more interested in all things Visual Studio Online and Team Foundation Server.

(If you want to know more about DevOps and how it can help transform your business, email me)

As head of the TFS team, Brian is in a unique position to share how he manages his team and runs his development life cycle. Read the rest of this post »

Azure: Did You Know? Always On Web Apps

alwayson-1When you creating a new web app (or web site, how it used to be called until recently) it’s have “Always On” setting off by default, which means the web site will be recycled after period of inactivity (20 minutes). This setting is somewhat similar to “Idle Time-out” setting on IIS application pool.When you web app is recycled, it will take Azure some time to bring it up the site when it’s accessed next time (in my experience it may take about 5-10 seconds) which could be frustrating for user.  So enabling “Always On” setting on Azure web app increases application responsiveness, especially if application is not very frequently accessed by users.

Read the rest of this post »

Top 10 Announcements from Build 2015 Keynote on Day 1

The 2015 BUILD Conference kicked off today, and today’s keynote was packed full of TONS of announcements and new information. Some of these things are going to be released sometime this year, but some of it has also been released to be available today! Even though you can watch the Build 2015 Day 1 Keynote anytime online, I thought I’d compress it down to the points I think are the most significant.

Keep in mind, this isn’t a full list of everything announced. Honestly, you have to watch the keynote to get everything.

Visual Studio Code for OSX / Linux / Windows

Visual Studio Code Announcement
This is exactly what it looks like, a lite version of Visual Studio that runs on ANY operating system you want. As of today, Visual Studio isn’t only on Windows anymore.

Visual Studio Code can be downloaded today, here:

Windows Holographic Platform


The Windows Holographic Platform is the platform behind the hardware that is HoloLens; Microsoft’s Augmented Reality glasses/headset. This is some super innovative technology that has the potential to fundamentally transform the way we use computers. The HoloLens was first announced a few months back, but today Microsoft shed a little more light on the technology surrounding it:

  1. HoloLens applications are built as Universal Windows Apps and distributed through the Windows Store
  2. HoloLens is stand alone and doesn’t require a phone or PC to use
  3. Any Universal Windows App can be placed / overlaid on your wall, refrigerator, or what ever you want within your space

Universal Windows Apps = 1 Platform & 1 Binary


Universal Windows App will allow for developers to build a single application and distribute that application as a single binary that will run on any device that runs Windows 10; including: phones, tablets, laptops, desktops, Xbox, HoloLens and IoT (Internet of Things) devices.

Universal Apps built with Web, .NET, Win32, Java, C++ or Objective-C


This one is a handful of awesome! The tooling for building Universal Windows Apps will support the ability to write Universal Windows Apps with .NET, Win32, C++, Java, Objective-C and web technologies (html/javascript). You’ll be able to share code between Android and/or iOS with your Universal Windows Apps!

Web Apps as Universal Windows Apps

Web apps will be able to be registered in the Windows Store so that they run on Windows 10 as if they are a native Universal Windows App.

Android App Support

Windows 10 will have a Android based sub-system that will allow for Android apps to be packaged up and distributes through the Windows Store. This is to make it extremely simple to take an existing Android app or Android Java code and reuse it to target the Windows 10 Platform.

One thing to note about the Android sub-system is that it will run the apps within a sandboxed environment, so the system can be kept safe and secure.

Windows Store for Business


The Windows Store will be able to be customized by companies and schools who wish to customize the apps listed.

Windows Phone as Desktop Replacement

Functionality was announced with a demo of using a Windows 10 Phone as a desktop computer by connecting an HDMI monitor/tv with Bluetooth keyboard and mouse. Universal Windows Apps run on the phone as normal, but when you connect a monitor/keyboard/mouse you can use the apps as if you’re on a desktop computer.

Microsoft Edge Browser


The Microsoft Edge Browser was announced as the official name of the new web browser from Microsoft that was formerly known as Project Spartan. This is a browser that is “built for doing” by integrating built-in note taking and sharing. The Edge browser will also include support for Browser Extensions built with standards based JavaScript and HTML.

New Azure SQL Database Features


There are a few new features being introduced to Azure SQL Databases:


This was a very exciting day to kick start a very exciting week for Microsoft and the Windows platform! There is so much more in the Build 2015 Day 1 Keynote than I could list here. If you’re interested, I encourage you to go watch/listen to the full keynote over on Channel 9.


Image Credits: The images above were taken from screenshots of the keynote video.

Working with dynamic schema in Azure DocumentDB

dynamicAbout a week ago Azure DocumentDB, a new Microsoft’s entry into NoSql database market, become generally available. DocumentDB allows user to to store/update/delete arbitrary objects (as complex as needed, not limited by relation structure) and query these objects using a special (quite limited) flavor of SQL (yes, SQL!) or LINQ when it’s used from .NET. Although these kinds of databases are called NoSql, they should rather be called object databases, or non-relational, because, well, you can still use SQL to query them.

So, these objects that you can story in DocumentDB, they could be really anything. However, in order to effectively use DocumentDB .NET client library, you need to know the object schema in advance. For example, let’s say you have the following class:

public class Person
  public string FirstName { get; set; }
  public string LastName { get; set; }

And then you instantiating the object of this class and storing it to DocumentDB (assuming that you already created database, document connection and client): Read the rest of this post »

BUILD & IGNITE Know It. Prove It. Tech Challenge Tour


I recently blogged about my personal experiences with the first “Know it. Prove it.” challenge that ran through the month of February 2015. The “Know it. Prove it.” challenge is back! This time it’s bigger and better than ever. The new challenge is a companion to both the Build and Ignite Conferences with 11 amazing tracks for both Developers and IT Professionals. Also, just like the first round, this set of challenges are completely Free!

Join the tour and accept a challenge today.

Whether you’re looking to learn something new or just brush up on something you’re already using, there’s definitely a challenge track for you.

Read the rest of this post »

Creating Microsoft FIM Management Agent: lessons learned

extensibilityMicrosoft FIM (Frontend Identity Manager) is a popular enterprise product which is allowing to automate user creation, provisioning and de-provisioning in Microsoft Active Directory. FIM has many out-of-the-box extension connectors which allows for connecting FIM to external systems (like external user catalogs), including a set of web services. When out-of-the-box connectors are not sufficient, it’s possible to implement a custom Management Agent (MA) for FIM using .NET framework.

I recently helped to connect FIM to external system which had MySQL user database. There is no out-of-the-box FIM connector for MySQL, we had to implement our own custom management agent. While working on this task I found out that the process of creating FIM MAs is very scarcely documented. This reference and that example is pretty my the only source of information about creating Extensible Connectivity Management Agents (ECMA). The problem though is that the reference doesn’t provide a complete documentation for creating ECMAs and the code example, while providing a complete code listing for management agent, doesn’t cover all everything. In fact, the code sample represents one specific, quite simple case of ECMA 2.2 agents, and there are a couple of places in this example which require additional explanation.

Read the rest of this post »

Perficient is named a Sitecore Platinum Implementation Partner

Stephen Tynes

Stephen Tynes, Sitecore MVP, recently joined Perficient

Today, Perficient announced that we are now a Sitecore Platinum Implementation Partner.

Sitecore established the new designation to recognize  partners who distinguish themselves through their implementation capability, joint reference clients with Sitecore, and demonstrated thought leadership in customer experience management.

It’s been an exciting couple of months for Perficient’s Sitecore practice. In addition to being named a Platinum Implementation Partner for Sitecore, we recently welcomed Stephen Tynes to the Perficient team. Stephen has a deep background in the Microsoft stack and brings a wealth of experience covering all facets of the Sitecore platform across both sales and delivery. He is a graduate of Liberty University and spent the last 11 years with Avanade.

From the news release:

“We’re grateful to be recognized for the work we’ve done for our customers on the Sitecore platform,” said Stephen Tynes, Perficient’s Sitecore Practice Director and a Sitecore MVP. “Our team of digital strategists, experience designers, and technologists is second to none, and Sitecore’s recognition of Perficient as one of their Platinum Implementation Partners is just another indication of that. With Sitecore and Perficient, you truly can create customers for life.”

Sitecore’s experience platform combines web content management, marketing automation, email marketing, social media, e-commerce, optimization, and analytics into a single, unified platform. The platform captures every interaction that customers and prospects have with a brand, whether on a website or through other digital channels.

“Our congratulations go out to Perficient,” said Dominic Citino, vice president of global partnerships and alliances at Sitecore. “This new designation as a Platinum Implementation Partner illustrates how Perficient can complete Sitecore’s vision for customer experience management and deliver these projects at scale.

“Perficient has demonstrated an extensive understanding of the entire Sitecore offering, has deep Sitecore experience and is committed to creating happy Sitecore customers,” Citino said.

You can read the full news release here.

Azure Search: Scoring Profiles


When a search query is submitted to the index, each document that is returned has a search scoreazuresearch_configure1_5_searchtile which is an indicator of its relevance in the current search query and context. The higher the score, the more relevant the item and therefore, the higher it is ranked on a scale of high to low.

In Azure Search, you can tweak the calculation of a search score through an index modification called a scoring profile. A common usage of scoring profiles is Geo-search, which allows you to automatically boost items which are closer to the location of the user. You can also simply boost by pushing newer documents to the top of your search results, or in some cases boost some older documents. It all depends on what your business needs are.

You can configure as many scoring profiles as you would like in your search index, but you can only specify one profile at a time when running a query.

Scoring Profiles vs. Managed Property Weighting and XRANK

For the SharePoint Devs out there getting into Azure Search, Scoring Profiles is a lot like Managed Property Weighting combined with XRANK in SharePoint. However, I find that Azure Search gives you control that allows you too really customize your boosting in ways that SharePoint cannot. Most of your boosting control comes in how you define your scoring profiles in your index, which allows you to really clean up your query on the front end without having to use XRANK. For example, to achieve a simple Geo-search, you would only need to provide the scoring profile and the current location as parameters in your search query.

As a further bonus, you can configure as many different scoring profiles as you would like, giving you full control of how your query gets processed. While in SharePoint, you can only configure a single set of relevancy rules without using XRANK, in Azure Search you can configure as many as you would like and specify which one you would like to use at the time. This way you can specify different weights for different fields (managed properties) when your business needs change without having to completely clobber the back-end index.  Read the rest of this post »