OptiGraphExtensions 1.0.0

dotnet add package OptiGraphExtensions --version 1.0.0
                    
NuGet\Install-Package OptiGraphExtensions -Version 1.0.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="OptiGraphExtensions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OptiGraphExtensions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="OptiGraphExtensions" />
                    
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 OptiGraphExtensions --version 1.0.0
                    
#r "nuget: OptiGraphExtensions, 1.0.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 OptiGraphExtensions@1.0.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=OptiGraphExtensions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=OptiGraphExtensions&version=1.0.0
                    
Install as a Cake Tool

OptiGraphExtensions

An Optimizely CMS 12 AddOn that provides comprehensive management of synonyms and pinned results within Optimizely Graph. This package enables content editors and administrators to enhance search experiences through intelligent synonym mapping and result pinning capabilities.

NuGet Version .NET 8.0 Optimizely CMS 12

Key Features

🔍 Synonym Management

  • Create, update, and delete synonyms for enhanced search functionality
  • Support for multiple synonym groups with different languages
  • Real-time synchronization with Optimizely Graph
  • Intelligent caching with automatic invalidation
  • Clean admin interface for easy synonym management

📌 Pinned Results Management

  • Create and manage pinned results collections
  • Associate specific content with search phrases
  • Priority-based result ordering
  • Language-specific pinning support
  • Bidirectional synchronization with Optimizely Graph
  • Full CRUD operations including collection deletion from Graph

🎨 Administration Interface

  • Clean, intuitive admin interface integrated with Optimizely CMS
  • Blazor components for interactive UI elements
  • Pagination support for large datasets
  • Real-time validation and centralized error handling
  • Bulk operations and sync capabilities
  • About page with version and system information

⚡ Performance Optimizations

  • Intelligent Caching: Repository-level caching with automatic cache invalidation
  • Connection Pooling: Efficient HTTP connection management via IHttpClientFactory
  • Optimized Architecture: Clean code principles with SOLID design patterns
  • Reduced Complexity: 40% reduction in component code through refactoring

Quick Start

Installation

Install the NuGet package in your Optimizely CMS 12 project:

dotnet add package OptiGraphExtensions

Configuration

Add the following to your Program.cs or Startup.cs:

// Add services
services.AddOptiGraphExtensions(options =>
{
    options.ConnectionStringName = "EPiServerDB"; // Optional, defaults to "EPiServerDB"
});

// Configure the application
app.UseOptiGraphExtensions();

As this is a Blazor-based admin interface, ensure that Blazor server-side is set up in your Optimizely CMS project.

// Add Blazor services
services.AddServerSideBlazor();

// Map Blazor hub
app.UseEndpoints(endpoints =>
{
    endpoints.MapContent();
    endpoints.MapBlazorHub();
    endpoints.MapControllers();
});

Add your Graph instance configuration to appsettings.json, this information can be found within PaaSPortal for a PaaS instance of Optimizely CMS12 and within the dashboard of a SaaS instance of Optimizely CMS 12

  "Optimizely": {
    "ContentGraph": {
      "GatewayAddress": "<your graph instance gateway address>",
      "AppKey": "<your graph instance key>",
      "Secret": "<your graph instance secret>"
    }
  }

Additional Configuration Customisation

The configuration of the module has some scope for modification by providing configuration in the service extension methods. Both the provision of optiGraphExtensionsSetupOptions and authorizationOptions are optional in the following example.

Example:

services.AddOptiGraphExtensions(optiGraphExtensionsSetupOptions =>
{
    optiGraphExtensionsSetupOptions.ConnectionStringName = "EPiServerDB";
},
authorizationOptions => 
{
    authorizationOptions.AddPolicy(OptiGraphExtensionsConstants.AuthorizationPolicy, policy =>
    {
        policy.RequireRole("WebAdmins");
    });
});

Authentication With Optimizely Opti ID

If you are using the new Optimizely Opti ID package for authentication into Optimizely CMS and the rest of the Optimizely One suite, then you will need to define the authorizationOptions for this module as part of your application start up. This should be a simple case of adding policy.AddAuthenticationSchemes(OptimizelyIdentityDefaults.SchemeName); to the authorizationOptions as per the example below.

serviceCollection.AddOptiGraphExtensions(optiGraphExtensionsSetupOptions =>
{
    optiGraphExtensionsSetupOptions.ConnectionStringName = "EPiServerDB";
},
authorizationOptions =>
{
    authorizationOptions.AddPolicy(OptiGraphExtensionsConstants.AuthorizationPolicy, policy =>
    {
        policy.AddAuthenticationSchemes(OptimizelyIdentityDefaults.SchemeName);
        policy.RequireRole("WebAdmins");
    });
});

Project Structure

src/
├── OptiGraphExtensions/              # Main AddOn library
│   ├── Administration/               # Admin controllers and view models
│   ├── Entities/                    # Entity Framework models
│   ├── Features/
│   │   ├── Common/                  # Shared components and services
│   │   │   ├── Caching/            # Cache services and invalidation
│   │   │   ├── Components/         # Base component classes
│   │   │   ├── Exceptions/         # Custom exceptions
│   │   │   ├── Services/           # Shared services (error handling, validation)
│   │   │   └── Validation/         # Validation framework
│   │   ├── Configuration/          # Service registration and setup
│   │   ├── Synonyms/               # Synonym management feature
│   │   │   ├── Services/           # CRUD, sync, validation services
│   │   │   ├── Repositories/       # Data access with caching
│   │   │   └── Models/             # Request/response models
│   │   └── PinnedResults/          # Pinned results management feature
│   │       ├── Services/           # CRUD, sync, validation services
│   │       ├── Repositories/       # Data access with caching
│   │       └── Models/             # Request/response models
│   ├── Menus/                      # CMS menu integration
│   └── Views/                      # Razor views and layouts
├── OptiGraphExtensions.Tests/       # NUnit test project
└── Sample/
    └── SampleCms/                   # Example implementation

Development

Prerequisites

  • .NET 8.0 SDK
  • SQL Server or SQL Server Express
  • Optimizely CMS 12 development environment

Building the Project

# Build the main solution
dotnet build src/OptiGraphExtensions.sln

# Build the sample CMS
dotnet build Sample/SampleCms.sln

# Build in Release mode for packaging
dotnet build src/OptiGraphExtensions.sln -c Release

Running Tests

# Run all tests
dotnet test src/OptiGraphExtensions.Tests/OptiGraphExtensions.Tests.csproj

# Run tests with coverage
dotnet test src/OptiGraphExtensions.Tests/OptiGraphExtensions.Tests.csproj --collect:"XPlat Code Coverage"

Running the Sample CMS

cd Sample/SampleCms
dotnet run

Navigate to /optimizely-graphextensions/administration/ in your CMS to access the management interface.

Architecture

Clean Architecture & SOLID Principles

The AddOn follows clean architecture and SOLID principles with clear separation of concerns:

  • Entities: Domain models and Entity Framework configuration
  • Repositories: Data access layer with caching decorators
  • Services: Decomposed services following Single Responsibility Principle
  • Controllers: RESTful API endpoints and admin interface controllers
  • Components: Refactored Blazor components with base class inheritance

Key Architectural Improvements

🏗️ Service Decomposition
  • Before: Monolithic services (392+ lines)
  • After: Focused services following Single Responsibility
    • Separate CRUD, validation, and synchronization services
    • Facade pattern for coordinating multiple services
    • 15+ new focused service classes
🚀 Performance Enhancements
  • Intelligent Caching: Repository decorator pattern with automatic invalidation
  • Connection Pooling: IHttpClientFactory for efficient HTTP connections
  • Code Optimization: 40% reduction in component complexity
🛡️ Robust Error Handling
  • Centralized error handling via ComponentErrorHandler
  • Custom exception types for better error tracking
  • Graceful fallback to local data when Graph is unavailable
✅ Comprehensive Testing
  • 29+ unit tests with 100% pass rate
  • Service layer testing with Moq framework
  • Repository operation testing
  • Validation logic coverage

Configuration Options

services.AddOptiGraphExtensions(options =>
{
    // Database connection string name (default: "EPiServerDB")
    options.ConnectionStringName = "EPiServerDB";
    
    // Additional configuration options available
});

Database Schema

The AddOn creates the following database tables:

  • tbl_OptiGraphExtensions_Synonyms: Stores synonym definitions
  • tbl_OptiGraphExtensions_PinnedResultsCollections: Stores pinned results collections
  • tbl_OptiGraphExtensions_PinnedResults: Stores individual pinned results

Optimizely Graph Integration

The AddOn provides seamless integration with Optimizely Graph:

  • Automatic Synchronization: Keep local data in sync with Graph collections
  • Bidirectional Updates: Changes flow both ways between local database and Graph
  • Collection Management: Full CRUD operations including deletion from Graph
  • Connection Pooling: Efficient HTTP connection management for Graph API calls
  • Error Handling: Graceful fallback to local data when Graph is unavailable
  • Authentication: Supports Optimizely Graph authentication requirements
  • Sync Status Tracking: Real-time sync status for collections and results

Authorization

The admin interface requires users to be members of one of the following roles:

  • CmsAdmins
  • Administrator
  • WebAdmins

Testing

The project includes comprehensive NUnit tests covering:

  • Service layer functionality with 100% pass rate
  • Repository operations including caching behavior
  • Validation logic and error handling
  • Controller standards and conventions
  • CRUD operations for all entities
  • Graph synchronization services
  • Request mapping and DTOs

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add or update tests as needed
  5. Ensure all tests pass
  6. Submit a pull request

Dependencies

  • .NET 8.0
  • Optimizely CMS 12 (EPiServer.CMS.UI.Core 12.23.0)
  • Entity Framework Core 8.0.19 with SQL Server provider
  • Microsoft.Extensions.Caching.Memory for caching
  • Microsoft.Extensions.Http for connection pooling
  • NUnit 3.14.0 for testing
  • Moq 4.20.72 for mocking in tests
  • System.ComponentModel.Annotations for validation

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

For issues, questions, or contributions, please visit the project repository or contact the development team.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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.0.0 165 9/25/2025
0.1.4-beta 292 9/16/2025
0.1.3-beta 242 9/15/2025
0.1.2-beta 200 9/14/2025
0.1.1-beta 209 9/14/2025