OakPeak.Core
8.0.5
dotnet add package OakPeak.Core --version 8.0.5
NuGet\Install-Package OakPeak.Core -Version 8.0.5
<PackageReference Include="OakPeak.Core" Version="8.0.5" />
<PackageVersion Include="OakPeak.Core" Version="8.0.5" />
<PackageReference Include="OakPeak.Core" />
paket add OakPeak.Core --version 8.0.5
#r "nuget: OakPeak.Core, 8.0.5"
#addin nuget:?package=OakPeak.Core&version=8.0.5
#tool nuget:?package=OakPeak.Core&version=8.0.5
OakPeak.Core
Description
OakPeak.Core is a powerful framework for building enterprise-grade microservices and web applications in .NET. It provides a comprehensive set of APIs, tools, and utilities to streamline your development process and enhance productivity.
Features
- Multi-version Support: Compatible with .NET 5, .NET 6, and .NET 8
- Authentication & Security: JWT, Basic Auth, API Key, and external providers (Microsoft, Google, Facebook)
- Multi-tenancy: Built-in support for multi-tenant applications
- Background Processing: Robust scheduler with cron-based task scheduling
- Data Access: Repository pattern implementation with SQL helpers
- Notification System: Email and cloud notification services
- Logging & Monitoring: Structured logging with Serilog integration
- API Documentation: Swagger/OpenAPI integration
- Health Checks: Built-in health monitoring endpoints
Installation
NuGet Package
Install the package using NuGet Package Manager or by executing the following command in the Package Manager Console:
Install-Package OakPeak.Core
For specific .NET versions:
# For .NET 6
Install-Package OakPeak.Core -Version 6.0.2
# For .NET 8
Install-Package OakPeak.Core -Version 8.0.5
System Architecture
OakPeak.Core follows a multi-layered architecture:
Core Components
- Controllers: Handle API endpoints and request processing
- Services: Implement business logic and application workflows
- Repositories: Manage data access and persistence
- Entities: Represent domain objects and data models
Middleware Pipeline
OakPeak.Core includes several middleware components for cross-cutting concerns:
- AppContextMiddleware: Manages application context for each request
- ApiKeyMiddleware: Handles API key authentication
- BasicAuthenticationMiddleware: Processes HTTP Basic authentication
- ErrorHandlingMiddleware: Provides centralized error handling
- DomainErrorHandlerMiddleware: Handles domain-specific errors
Authentication and Security
Multiple authentication methods are supported:
- JWT Token Authentication: For secure API access
- Basic Authentication: For simple username/password authentication
- API Key Authentication: For service-to-service communication
- External Providers: Microsoft, Google, Facebook integration
Multi-tenancy Support
The framework includes built-in multi-tenancy capabilities:
- Tenant identification based on host, query string, or custom logic
- Tenant-specific configuration and settings
- Tenant isolation for data and resources
Setup and Configuration
Basic Setup
Add OakPeak.Core to your ASP.NET Core application in Program.cs
or Startup.cs
:
// Add services
services.AddOakPeakCore(Configuration);
// Configure middleware
app.UseOakPeak();
Configuration Files
Configure OakPeak.Core in your appsettings.json
:
{
"ConnectionStrings": {
"DefaultConnection": "Server=...;Database=...;User Id=...;Password=...;"
},
"AppSettings": {
"EnableSwagger": true,
"HealthBaseUrl": "https://your-api-base-url.com"
},
"JwtIssuerOptions": {
"Issuer": "your-issuer",
"Audience": "your-audience",
"Subject": "your-subject",
"ValidFor": "24:00:00",
"Key": "your-secret-key-with-at-least-16-characters"
},
"EmailConfiguration": {
"Provider": "smtp",
"SmtpServer": "smtp.example.com",
"SmtpPort": 587,
"SmtpUsername": "user@example.com",
"SmtpPassword": "password",
"FromEmail": "noreply@example.com",
"UseSsl": true,
"Title": "Your Application Name",
"TemplateFile": "email-template.html"
}
}
Key Components
Authentication
Configure authentication in your application:
services.AddAuthentication(options => {
options.JwtIssuerOptions = new JwtIssuerOptions {
Issuer = Configuration["JwtIssuerOptions:Issuer"],
Audience = Configuration["JwtIssuerOptions:Audience"],
Subject = Configuration["JwtIssuerOptions:Subject"],
ValidFor = Configuration.GetValue<TimeSpan>("JwtIssuerOptions:ValidFor"),
Key = Configuration["JwtIssuerOptions:Key"],
};
});
Scheduler
Create scheduled tasks by implementing the IScheduledTask
interface:
public class MyScheduledTask : BaseSchedulerTask
{
public override string Schedule => "0 */12 * * *"; // Cron expression
public override async Task DoWork()
{
// Task implementation
await Task.CompletedTask;
}
}
Register scheduled tasks:
services.AddScheduler((sender, args) => {
Console.Write(args.Exception.Message);
args.SetObserved();
});
services.AddSingleton<IScheduledTask, MyScheduledTask>();
Notification System
Send emails using the notification service:
public class MyService
{
private readonly INotificationService _notificationService;
public MyService(INotificationService notificationService)
{
_notificationService = notificationService;
}
public async Task SendNotification()
{
await _notificationService.CreateAndSendHtmlEmail(
"recipient@example.com",
"Recipient Name",
"Email Subject",
"<p>Email body content</p>"
);
}
}
Data Access
Use the data provider for database operations:
public class MyRepository
{
private readonly IDataProvider _dataProvider;
public MyRepository(IDataProvider dataProvider)
{
_dataProvider = dataProvider;
}
public IEnumerable<MyEntity> GetItems()
{
return _dataProvider.ExecuteReader("GetItems").FillCollection<MyEntity>();
}
}
CI/CD Integration
OakPeak.Core includes Azure DevOps pipeline configurations for different .NET versions:
azure-pipelines.yml
- Main pipeline for .NET 5azure-pipelines-NET6.yml
- Pipeline for .NET 6azure-pipelines-NET8.yml
- Pipeline for .NET 8
These pipelines automate the build, test, and deployment processes for your applications.
API Documentation
OakPeak.Core integrates with Swagger/OpenAPI for API documentation. Enable it in your application:
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Your API", Version = "v1" });
c.EnableAnnotations();
});
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Your API v1"));
License
This project is licensed under the MIT License.
Support
For issues, questions, or contributions, please contact us or open an issue on the repository.
Acknowledgements
OakPeak.Core is developed and maintained by Brighten Consulting.
© 2023 Brighten Consulting. All rights reserved.
This documentation is subject to change as the framework evolves. Always refer to the latest version for the most up-to-date information.
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 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. |
-
net8.0
- AspNetCore.HealthChecks.UI (>= 8.0.1)
- AspNetCore.HealthChecks.Uris (>= 8.0.1)
- AutoMapper (>= 13.0.1)
- Azure.Monitor.OpenTelemetry.AspNetCore (>= 1.2.0)
- HtmlAgilityPack (>= 1.11.64)
- MailKit (>= 4.7.1.1)
- Microsoft.AspNetCore.Authentication.Facebook (>= 8.0.8)
- Microsoft.AspNetCore.Authentication.Google (>= 8.0.8)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.8)
- Microsoft.AspNetCore.Authentication.MicrosoftAccount (>= 8.0.8)
- Microsoft.AspNetCore.Identity.EntityFrameworkCore (>= 8.0.8)
- Microsoft.AspNetCore.RateLimiting (>= 7.0.0-rc.2.22476.2)
- Microsoft.Data.SqlClient (>= 5.2.1)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.8)
- Microsoft.Extensions.FileProviders.Physical (>= 8.0.0)
- Microsoft.Extensions.Identity.Core (>= 8.0.8)
- Microsoft.Extensions.Identity.Stores (>= 8.0.8)
- Microsoft.Identity.Web (>= 3.1.0)
- ObjectsComparer (>= 1.4.1)
- SendGrid (>= 9.29.3)
- Serilog.AspNetCore (>= 8.0.2)
- Serilog.Extensions.Hosting (>= 8.0.0)
- Serilog.Sinks.Console (>= 6.0.0)
- Swashbuckle.AspNetCore (>= 6.7.3)
- Swashbuckle.AspNetCore.Annotations (>= 6.7.3)
- Swashbuckle.AspNetCore.Filters (>= 8.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on OakPeak.Core:
Package | Downloads |
---|---|
Brighten.Plab.Models
Provides the component model for Brighten's AppMyWork |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.5 | 139 | 4/20/2025 |
8.0.4 | 157 | 8/12/2024 |
8.0.3 | 138 | 8/12/2024 |
8.0.2 | 138 | 8/12/2024 |
8.0.1 | 146 | 8/12/2024 |
6.0.3 | 168 | 4/20/2025 |
6.0.2 | 134 | 8/12/2024 |
6.0.1 | 130 | 8/12/2024 |
5.1.15 | 153 | 4/20/2025 |
5.1.14 | 103 | 10/23/2024 |
5.1.13 | 92 | 10/23/2024 |
5.1.12 | 176 | 7/17/2024 |
5.1.11 | 117 | 7/15/2024 |
5.1.10 | 114 | 7/15/2024 |
5.1.9 | 122 | 7/15/2024 |
5.1.8 | 113 | 7/15/2024 |
5.1.7 | 126 | 5/9/2024 |
5.1.6 | 162 | 2/28/2024 |
5.1.5 | 181 | 2/16/2024 |
5.1.4 | 198 | 1/25/2024 |
5.1.3 | 221 | 12/27/2023 |
5.1.2 | 367 | 6/11/2023 |
5.1.1 | 156 | 6/11/2023 |
5.0.34 | 221 | 5/27/2023 |
5.0.33 | 173 | 5/26/2023 |
5.0.32 | 152 | 5/25/2023 |
5.0.31 | 252 | 4/17/2023 |
5.0.30 | 273 | 3/31/2023 |
5.0.29 | 277 | 3/23/2023 |
5.0.28 | 241 | 3/22/2023 |
5.0.27 | 863 | 2/15/2023 |
5.0.26 | 844 | 2/6/2023 |
5.0.25 | 414 | 12/5/2022 |
5.0.24 | 701 | 11/8/2022 |
5.0.23 | 384 | 11/6/2022 |
5.0.22 | 376 | 11/6/2022 |
5.0.21 | 363 | 11/6/2022 |
5.0.20 | 396 | 11/6/2022 |
5.0.19 | 429 | 10/30/2022 |
5.0.18 | 807 | 10/13/2022 |
5.0.17 | 986 | 9/19/2022 |
5.0.16 | 873 | 9/19/2022 |
5.0.15 | 1,187 | 9/19/2022 |
5.0.14 | 914 | 9/19/2022 |
5.0.13 | 910 | 7/30/2022 |
5.0.12 | 526 | 7/2/2022 |
5.0.11 | 574 | 6/13/2022 |
5.0.10 | 551 | 5/31/2022 |
5.0.9 | 665 | 3/17/2022 |
5.0.8 | 601 | 3/16/2022 |
5.0.7 | 618 | 3/14/2022 |
5.0.6 | 575 | 3/14/2022 |
5.0.5 | 663 | 3/2/2022 |
5.0.4 | 663 | 2/21/2022 |
5.0.3 | 661 | 1/21/2022 |
5.0.2 | 780 | 12/27/2021 |
5.0.1 | 538 | 6/10/2021 |
1.0.3 | 1,304 | 11/4/2020 |
1.0.2 | 1,233 | 10/25/2020 |
1.0.1 | 1,148 | 10/25/2020 |
1.0.0 | 1,267 | 10/25/2020 |
Security and critical updates