Osirion.Blazor.Cms.Application
2.1.5
dotnet add package Osirion.Blazor.Cms.Application --version 2.1.5
NuGet\Install-Package Osirion.Blazor.Cms.Application -Version 2.1.5
<PackageReference Include="Osirion.Blazor.Cms.Application" Version="2.1.5" />
<PackageVersion Include="Osirion.Blazor.Cms.Application" Version="2.1.5" />
<PackageReference Include="Osirion.Blazor.Cms.Application" />
paket add Osirion.Blazor.Cms.Application --version 2.1.5
#r "nuget: Osirion.Blazor.Cms.Application, 2.1.5"
#:package Osirion.Blazor.Cms.Application@2.1.5
#addin nuget:?package=Osirion.Blazor.Cms.Application&version=2.1.5
#tool nuget:?package=Osirion.Blazor.Cms.Application&version=2.1.5
Osirion.Blazor.Cms.Application
Application layer for the Osirion.Blazor CMS ecosystem, implementing core business logic, use cases, and application services.
Overview
The Application project represents the application layer in the Clean Architecture pattern, bridging the domain models with the infrastructure and presentation layers. It contains application services, DTOs, validators, mappers, and command/query handlers.
Components
Application Services
Services that orchestrate the application logic:
public class ContentApplicationService : IContentApplicationService
{
private readonly IContentRepository _repository;
private readonly IMarkdownProcessor _markdownProcessor;
private readonly ILogger<ContentApplicationService> _logger;
public ContentApplicationService(
IContentRepository repository,
IMarkdownProcessor markdownProcessor,
ILogger<ContentApplicationService> logger)
{
_repository = repository;
_markdownProcessor = markdownProcessor;
_logger = logger;
}
public async Task<ContentDto> GetContentByPathAsync(string path)
{
var content = await _repository.GetByPathAsync(path);
if (content is null)
{
_logger.LogWarning("Content not found for path: {Path}", path);
throw new ContentNotFoundException(path);
}
var processedContent = await _markdownProcessor.ProcessAsync(content.Content);
return MapToDto(content, processedContent);
}
// Additional methods
}
DTOs (Data Transfer Objects)
Objects used to transfer data between the application and presentation layers:
public class ContentDto
{
public string Path { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string ProcessedContent { get; set; } = string.Empty;
public string RawContent { get; set; } = string.Empty;
public Dictionary<string, object> Metadata { get; set; } = new();
public DateTime? PublishedDate { get; set; }
public string? Author { get; set; }
public List<string> Tags { get; set; } = new();
public List<string> Categories { get; set; } = new();
public bool IsFeatured { get; set; }
public string? FeaturedImage { get; set; }
}
Validators
Input validation using FluentValidation:
public class ContentQueryValidator : AbstractValidator<ContentQueryDto>
{
public ContentQueryValidator()
{
RuleFor(x => x.Path)
.NotEmpty()
.When(x => x.Directory is null && x.Tag is null && x.Category is null);
RuleFor(x => x.Skip)
.GreaterThanOrEqualTo(0);
RuleFor(x => x.Count)
.GreaterThanOrEqualTo(1)
.When(x => x.Count.HasValue);
}
}
Key Features
Markdown Processing
Advanced markdown processing with support for:
- Front matter extraction and parsing
- Syntax highlighting
- Table rendering
- Task lists
- Automatic linking
- Diagrams and charts
- Custom extensions
Content Caching
Efficient content handling with caching:
public async Task<ContentDto> GetContentByPathAsync(string path)
{
var cacheKey = $"content:{path}";
if (_cache.TryGetValue(cacheKey, out ContentDto? cachedContent))
return cachedContent!;
var content = await _repository.GetByPathAsync(path);
// Process and map content
var options = new MemoryCacheEntryOptions()
.SetSlidingExpiration(TimeSpan.FromMinutes(30))
.SetAbsoluteExpiration(TimeSpan.FromHours(2));
_cache.Set(cacheKey, result, options);
return result;
}
Dependencies
The application layer has the following dependencies:
- Osirion.Blazor.Cms.Domain: For domain entities and interfaces
- FluentValidation: For input validation
- Markdig: For Markdown processing
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions 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 is compatible. 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. |
-
net8.0
- FluentValidation (>= 11.11.0)
- Markdig (>= 0.41.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Osirion.Blazor.Cms.Domain (>= 2.1.5)
-
net9.0
- FluentValidation (>= 11.11.0)
- Markdig (>= 0.41.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- Osirion.Blazor.Cms.Domain (>= 2.1.5)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Osirion.Blazor.Cms.Application:
Package | Downloads |
---|---|
Osirion.Blazor.Cms.Core
Core CMS module for Osirion.Blazor - Provides cms management with provider pattern. |
|
Osirion.Blazor.Cms.Infrastructure
Infrastructure layer for the Osirion.Blazor CMS ecosystem, implementing repositories, external service integrations, and infrastructure concerns. |
GitHub repositories
This package is not used by any popular GitHub repositories.