Ozcorps.Core 9.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ozcorps.Core --version 9.0.0
                    
NuGet\Install-Package Ozcorps.Core -Version 9.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="Ozcorps.Core" Version="9.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ozcorps.Core" Version="9.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Ozcorps.Core" />
                    
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 Ozcorps.Core --version 9.0.0
                    
#r "nuget: Ozcorps.Core, 9.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 Ozcorps.Core@9.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=Ozcorps.Core&version=9.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Ozcorps.Core&version=9.0.0
                    
Install as a Cake Tool

Ozcorps.Core

Ozcorps.Core is a multi-targeted utility package for ASP.NET Core applications. It provides reusable building blocks for response modeling, dynamic query operations, encryption helpers, geometry conversion utilities, and Elasticsearch integration.

Target Frameworks

  • net8.0
  • net9.0
  • net10.0

Installation

dotnet add package Ozcorps.Core --version 9.0.0

What's Included

  • Ozcorps.Core.Models.Response<T> and Response
  • Dynamic query helpers in Ozcorps.Core.Extensions.QueryExtensions
  • Geometry conversion and projection helpers in Ozcorps.Core.Extensions.GeometryExtensions
  • Encryption abstractions and implementations (IEncryptor, IFileEncryptor, Md5Encryptor, RsaEncryptor, FileEncryptor)
  • Elasticsearch provider and generic service (IElasticSearchProvider, IElasticSearchService<T>)
  • Security headers middleware (HeadersMiddleware, HeaderOption)

Response Model

Use a consistent API response contract:

using Ozcorps.Core.Models;

var success = Response<string>.Ok("done", "Operation completed");
var failed = Response<string>.Fail("Validation failed", new Dictionary<string, string[]>
{
    ["Email"] = new[] { "Email is required" }
});

Response<T> includes:

  • Data
  • Success
  • Message
  • Errors
  • TraceId
  • Timestamp

Encryption Services

Register encryption services from DI extensions:

using Microsoft.Extensions.DependencyInjection;

builder.Services.AddRsaEncryptor();
builder.Services.AddMd5Encryptor();
builder.Services.AddFileEncryptor();

Required Configuration

RsaEncryptor expects:

{
  "Rsa": {
    "Public": "base64-public-key",
    "Private": "base64-private-key"
  }
}

Md5Encryptor uses:

{
  "Md5Key": "your-secret-key"
}

Elasticsearch Integration

Register provider and generic service:

using Microsoft.Extensions.DependencyInjection;

builder.Services.AddElasticSearchProvider();

Configuration:

{
  "ElasticSearch": {
    "Host": "http://localhost:9200"
  }
}

Usage:

public class ProductSearchService
{
    private readonly IElasticSearchService<Product> _service;

    public ProductSearchService(IElasticSearchService<Product> service)
    {
        _service = service;
    }

    public IQueryable<Product> Search(string index)
    {
        return _service.Search(index, page: 0, rowCount: 20);
    }
}

Query Extensions

QueryExtensions supports runtime filtering, searching, ordering, and pagination over IQueryable.

Example:

var filtered = query.SearchAnd(
    new[] { "Name", "Status" },
    new[] { "john", "active" },
    new[] { "contains", "==" });

var ordered = filtered.OrderHelper(
    new[] { "asc" },
    new[] { "Name" });

Geometry Extensions

The geometry helpers are based on NetTopologySuite and ProjNet.

Capabilities include:

  • WKT/WKB conversions
  • Simplification
  • SRID transformations (WGS84, WebMercator, TM, UTM variants)

Example:

using Ozcorps.Core.Extensions;

var geometry = "POINT(29.0 41.0)".WktToGeometry();
var mercator = geometry.ToWebMerkator();
var wkt = mercator.ToWkt();

Headers Middleware

HeadersMiddleware allows adding/removing security-related response headers using HeaderOption.

You can configure it in your pipeline by constructing HeaderOption and invoking the middleware.

Notes

  • Package metadata includes PackageReadmeFile, and this file is packed into the NuGet package.
  • XML documentation file generation is enabled.
  • Elasticsearch integration uses the Nest 7.x client.

License

MIT

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 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 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on Ozcorps.Core:

Package Downloads
Ozcorps.Logger

Package Description

Ozcorps.Ozt

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.1.0 89 3/11/2026
9.0.0 97 2/26/2026
8.4.0 934 9/17/2025
8.3.6 1,254 8/5/2025
8.3.5 2,395 7/11/2025
8.3.4 222 7/11/2025
8.3.3 202 7/11/2025
8.3.2 216 7/9/2025
8.3.0 249 4/9/2025
Loading failed