XperienceCommunity.ContentRepository 1.0.1

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

Xperience Community: Content Repository

Nuget

Description

This package provides a comprehensive repository pattern implementation for Kentico Xperience, offering simplified content access, enhanced caching, and streamlined dependency injection. It includes repositories for web pages, content items, and media files with advanced querying capabilities, automatic caching, and flexible configuration options.

Library Version Matrix

Xperience Version Library Version
>= 30.6.0 >= 1.0.0

Note: The latest version that has been tested is 30.6.0

⚙️ Package Installation

Add the package to your application using the .NET CLI

dotnet add package XperienceCommunity.ContentRepository

🚀 Quick Start

Basic Configuration

Register the repositories in your DI container:

public void ConfigureServices(IServiceCollection services)
{
    // Option 1: Configure specific types for automatic registration
    services.AddXperienceContentRepositories(options =>
    {
        options.PageTypes = [
            typeof(ArticlePage),
            typeof(BlogPostPage),
            typeof(HomePage)
        ];
        
        options.ContentTypes = [
            typeof(SharedContent),
            typeof(NavigationItem),
            typeof(CTAContent)
        ];
    });

    // Option 2: Use generic repositories only
    services.AddXperienceContentRepositories();
}

Basic Usage

public class ContentService
{
    private readonly ContentRepositories _contentRepositories;

    public ContentService(ContentRepositories contentRepositories)
    {
        _contentRepositories = contentRepositories;
    }

    public async Task<IEnumerable<ArticlePage>> GetArticlesAsync()
    {
        var pageRepository = _contentRepositories.GetPageRepository<ArticlePage>();
        return await pageRepository.GetAll("en");
    }

    public async Task<IEnumerable<SharedContent>> GetSharedContentAsync()
    {
        var contentRepository = _contentRepositories.GetContentRepository<SharedContent>();
        return await contentRepository.GetAll("en");
    }

    public async Task<IEnumerable<MediaFileInfo>> GetMediaFilesAsync(IEnumerable<Guid> mediaGuids)
    {
        var mediaRepository = _contentRepositories.GetMediaFileRepository();
        return await mediaRepository.GetMediaFilesAsync(mediaGuids);
    }
}

✨ Features

Repository Pattern Implementation

Page Type Repository: Comprehensive repository for web page content types with support for:

  • Get by IDs, GUIDs, and custom where conditions
  • Path-based querying with flexible path matching modes
  • Multi-type queries (query multiple page types simultaneously)
  • Taxonomy tag filtering
  • Reusable schema support
  • Automatic URL path resolution

Content Type Repository: Full-featured repository for content items including:

  • Get all content with pagination support
  • Smart folder-based queries
  • Multi-type content retrieval
  • Custom where condition support
  • Reusable schema querying
  • Taxonomy tag filtering

Media File Repository: Specialized repository for media file operations:

  • Retrieve media files by GUIDs
  • Get media files from asset related items
  • Media library management
  • Automatic caching with dependency management

Advanced Querying Capabilities

  • Smart Folder Support: Query content from smart folders with multi-type support
  • Path Matching: Flexible path matching for web pages (exact, children, section)
  • Taxonomy Integration: Built-in support for taxonomy tag filtering
  • Custom Where Conditions: Flexible query building with custom where parameters
  • Multi-Language Support: Language-specific content retrieval
  • Linked Items: Configurable linked item depth for related content

Caching & Performance

  • Automatic Caching: Progressive caching with configurable expiration
  • Cache Dependencies: Intelligent cache invalidation based on content changes
  • Cache Key Management: Optimized cache key generation for better performance
  • Sliding Expiration: Configurable sliding expiration for better memory management

Dependency Injection Enhancements

  • Centralized Access: Single ContentRepositories service for all repository access
  • Type Safety: Full type safety with generic methods
  • Flexible Configuration: Configure specific types or use generic approach
  • Backward Compatibility: Works alongside existing repository patterns

Extension Methods & Utilities

  • Query Builder Extensions: Enhanced ContentItemQueryBuilder with conditional operations
  • Type Extensions: Automatic content type name resolution
  • Cache Dependency Helpers: Simplified cache dependency creation
  • Parameter Extensions: Extended where parameter functionality

📚 Examples

For detailed examples on how to use custom where conditions and other advanced features, check out the Examples folder in this repository. It contains practical implementations showing:

  • Custom where usage examples
  • Page custom where usage examples
  • General usage patterns

🙏 Acknowledgments

This project was inspired by the excellent work done by Brandon Henricks in his Xperience by Kentico Data Repository project. We built upon those foundational concepts to create this enhanced repository pattern implementation.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License.

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.0.1 229 8/7/2025
1.0.0 467 7/21/2025