LINQPad Driver for Sitecore Version 1.8

I'm happy to announce the release of LINQPad Driver for Sitecore 1.8. Read on for details on what changed and for a download link.

This release is pretty light on new features:

  • The "reset" links on the advanced settings tab prompts you before making changes.

  • If you have made changes to the connection settings and try to leave the configuration screen you are prompted to make sure you are OK with losing your changes.
  • Started using the attribute AssemblyInformationalVersion to track the driver version.
  • Changed the assembly version to 1.0, where it will remain. This will make it easier for developers who want to write custom components to grab the driver from Nuget.
  • "About Driver" dialog displays driver version and assembly version.

  • Better tabbing between input fields.
  • Default connection values are now saved with the connection.
  • The XML format for the Sitecore connection settings have been changed. I recommended deleting any existing connections and creating new connections.
  • LINQPad "drag text" a little smarter. This is explained in a separate post.
  • Refactoring... lots of refactoring.

My main goal in writing this post is to explain some of the features that I claimed worked in previous versions (but didn't), because now they do work.

A couple of releases back I added functionality that was supposed to allow you to replace various internal components, such as the app.config reader and the schema builder. Well, I didn't realize that the logic wasn't fully implemented in the version I released, so if you ever tried to actually use that functionality it probably didn't work.

The rest of this post offers an overview of the components you can specify. My next blog post will explain how to configure a development environment so you can create your own components.

App.config Reader

When Sitecore runs, the settings in web.config creating and initialize the Sitecore environment. The same thing needs to happen when Sitecore runs in LINQPad. While LINQPad doesn't have a web.config file, it does have an app.config file.

The app.config reader is responsible for reading the web.config file from the Sitecore server and making any changes that might be necessary. The default app.config reader does the following:

  • Read web.config from the file system using the driver setting WebRootPath
  • Read App_Config/ConnectionStrings.config from the file system and merge the settings into the appropriate section of web.config
  • Send a request to the Sitecore server for /admin/showconfig.aspx using the driver setting ClientUrl and replace the /configuration/sitecore section from web.config file the result from showconfig.aspx.
  • Remove the element encoding from the appenders in the log4net section.
  • The configStores defined in the section /configuration/sitecore/configStores have relative file paths. These paths are made absolute using the driver setting WebRootPath.

If you need additional changes, you need to extend the default app.config reader.

Schema Builder

LINQPad allows you to write LINQ statements. When you use the LINQPad Driver for Sitecore, the search indexes from the Sitecore server are exposed as objects called "Explorer Items". This is what you see on listed under the connection on the left-hand side of the LINQPad application.

Explorer Items are also available in the Query Editor. They are exposed as IQueryable<T> objects that you can use in your LINQ expressions.

The schema builder is responsible for exposing the Sitecore search indexes as Explorer Items. The LINQPad driver uses this component in the method GetSchemaAndBuildAssembly.

If you want to expose additional IQueryable<T> objects - or if you want to prevent certain search indexes from appearing- you need to extend the default schema builder.

Driver Initializer

Normally when the Sitecore environment starts the initialize pipeline runs. When Sitecore runs in the LINQPad context, this pipeline doesn't run.

The driver initializer is able to execute code that normally runs when the Sitecore server starts. The default driver initializer performs the following tasks:

  • Creates an instance of the type Sitecore.ContentSearch.Hooks.Initializer and runs the Initialize method.

The LINQPad driver uses this component in the InitializeContext method.


In my next post I explain how to set up development environment so you can start building these components.

Oh, you want to download version 1.8? Here you go.