Archive for : November, 2017

Synthesis: The Road Ahead

A couple months ago, Kam Figy joined a team of elite superheros known as the “The X Factor.” Wait… actually I think it’s “The X Team”? “X-Files”? I’m not sure. Go ask him. All I know is he’s off to do amazing things that will advance Sitecore in unimaginable ways in some super secret bunker in Cheyenne Mountain. Anyway, alongside that announcement, he mentioned that he was entrusting ownership of two of his most cherished, most famous, and most widely used repositories to me. That’s right, I am now the owner of Synthesis and Leprechaun. He kept a couple other, lesser known side-projects for himself. I think they’re called Unicycle and Rainboots or something like that.

The Future of Synthesis

Synthesis has been out there for quite a while. It’s used on countless projects and has at least 11,000 downloads as of the time of writing. So, with such a long history, where do we go from here? Well, I’ve created a GitHub Project that outlines some of the issues that are on the horizon.

Code Generation

The biggest change in the mid-term future will be the deprecation of Synthesis’ code generator. Leprechaun is an up-and-coming tool that uses Roslyn code generation to generate models that can be used not only in Synthesis, but any other ORM. Roslyn code gen is more flexible than the current Synthesis code gen and relies on C# script (.csx) files as the templates. It’s faster than T4 and a lot more portable. I’ll discuss more about Leprechaun at a later point though.

Synthesis’ code generation will not be going away. It’s used on too many projects and completely dropping it at this point would be irresponsible. Instead, I do plan on moving it to its own NuGet package and giving users the option to install it if they plan on using it.

Optimization

As I mentioned, Synthesis has been around for quite a while – about 4 years. 4 years is an eternity for code. I plan on going through everything and determining if there are any parts that were written for older versions of Sitecore that may or may not be needed anymore, and trying to optimize, revitalize, and Synthesize.

What Else?

What else remains to be seen. I have some plans that are still in my head and I want to formulate them a bit more before revealing to the world.

FAQ

Q: Okay, I read the blogpost. What’s Synthesis?
A: It’s an object mapper for Sitecore. It has full MVC integration and it’s just plain awesome, that’s what it is!

Q: How do I congratulate Kam on his new role at the X-Men?
A: This is about me right now, but since you asked you can reach out to him on Twitter or Slack I guess.

Q: I think I found a bug, what should I do?
A: Log it as an issue on GitHub

Q: I have a question, what should I do?
A: I’ve been known to hang around Sitecore Slack in the #Synthesis channel.

Q: What about Leprechaun’s Roadmap?
A: That will take up its own blog post – stay tuned!

Checking for Experience Explorer Context in Sitecore 9

With the release of Sitecore 9, a underappreciated DLL was removed: Sitecore.ExperienceExplorer.Business.dll.

I’ve honestly never paid much attention to that DLL. The one thing I used it for, however, was determining if the current context was Experience Explorer. Synthesis made use of this:

public class SitecoreRenderingContext : IRenderingContext
{
    ...
    public bool IsExperienceExplorer => Sitecore.ExperienceExplorer.Business.Managers.ModuleManager.IsExpViewModeActive;
    ...
}

The new way of handling this is via the IsExplorerMode method in the ExplorerContext class. This isn’t a static method, however. In order to maintain the static context, the above line was changed to:

public bool IsExperienceExplorer => DependencyResolver.Current.GetService<IExplorerContext>().IsExplorerMode();

I’m typically not a the #1 fan of DependencyResolver, but I wanted to ensure backwards compatibility.

You’ll need to include the following DLLs:

  • Sitecore.ExperienceExplorer — this is for the ExplorerContext class
  • Sitecore.ExperienceExplorer.Core — this is for the IExplorerContext interface

The new version of Synthesis compiled against Sitecore 9 will be up on NuGet next week.