Cmsql.Optimizely 1.1.0

dotnet add package Cmsql.Optimizely --version 1.1.0
                    
NuGet\Install-Package Cmsql.Optimizely -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cmsql.Optimizely" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cmsql.Optimizely" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Cmsql.Optimizely" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cmsql.Optimizely --version 1.1.0
                    
#r "nuget: Cmsql.Optimizely, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cmsql.Optimizely@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cmsql.Optimizely&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Cmsql.Optimizely&version=1.1.0
                    
Install as a Cake Tool

Cmsql.Optimizely

This is the Optimizely CMS specific implementation for the CMSQL - CMS Query Language. Please see the CMSQL repository for specifics on the CMS Query Language.

Getting started

On its own the Cmsql package can parse Cmsql queries but it needs a specific implementation to execute them. This is the Optimizely CMS (formerly known as EPiServer) specific implementation which uses the IPageCriteriaQueryService at its core. You could say this implementation exposes the IPageCriteriaQueryService through the query language.

Installation

You can install the NuGet package by running the following command:

dotnet add package Cmsql.Optimizely --version 1.0.0

Usage

The Cmsql package contains a CmsqlQueryService which is basically a facade that takes care of parsing and executing queries through the ExecuteQuery method. The ExecuteQuery method returns an instance of CmsqlQueryResultSet which is a composite type that contains information about the parsing and execution process. When no errors are encountered and data is found the result set should contain data in the form of a collection of ICmsqlQueryResult.

The following (Optimizely CMS specific) example demonstrates how to execute a query, check for errors and get data from the result set.

var resultSet = _cmsqlQueryService.ExecuteQuery("select ProductPage from start where PageName = 'Alloy Plan'");
if (resultSet.IsSuccess)
{
  var pages = resultSet.GetResults()
    .OfType<PageDataCmsqlQueryResult>()
    .Select(p => p.Page)
    .ToList();
}

Setup

The CmsqlQueryService needs to be given an instance of a ICmsqlQueryRunner through its constructor when instantiated. The specific ICmsqlQueryRunner implementation for this package is PageCriteriaQueryRunner. You are free to set this up yourself by for example StructureMap, this could look something like the following in your StructureMap configuration: x.For<ICmsqlQueryRunner>().Use<PageCriteriaQueryRunner>();

Limitations

Since the Cmsql.Optimizely package revolves around the IPageCriteriaQueryService it is also limited by it. For now, querying is limited to Pages (PageData) only, and one PageType per query.

For now, only the following operators are supported in query criteria:

  • = (Equals)
  • > (Greater than)
  • < (Less than)
  • != (Not equals)
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 175 3/28/2026
1.0.0 118 1/14/2026