Introducing Kepler.Core — Smart Field Selection for EF Core APIs

Published: (December 14, 2025 at 04:02 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Overview

Kepler.Core is an EF Core extension that lets you improve performance by selecting only the fields you need. It supports flexible filtering, exclusion of sensitive fields, and full visibility into the generated queries.

Key Features

  • Selective Field Retrieval – Choose exactly which properties to include in your queries.
  • Rich Filtering – Apply any filter type you need (e.g., Contains, StartsWith, Equals, etc.).
  • Sensitive Field Exclusion – Hide fields globally using attributes or the fluent API.
  • Global Override – Set IgnoreGlobalExceptions = true to bypass all exclusions when required.
  • Transparent SQL Generation – View the complete lambda expression and the SQL that the NuGet package produces—no black‑box behavior.
  • Policy Management – Define multiple named policies per model/table for different use‑cases.
  • Introspection Helpers – Inspect global excludes, filters, order‑by fields, and the properties selected by a policy.

Getting Started

  1. Add the package

    dotnet add package Kepler.Core
  2. Create a policy in your Program.cs (or wherever you configure services):

    services.AddKeplerCore(options =>
    {
        options.PolicyName = "MyPolicy";
        options.IgnoreGlobalExceptions = false;
        // configure includes, excludes, filters, etc.
    });
  3. Apply the policy when querying:

    var result = await dbContext.Customers
        .ApplyKeplerPolicy("MyPolicy")
        .ToListAsync();

    The query will only select the fields defined in MyPolicy and respect any global exclusions.

Multiple Policies

You can define as many policies as needed, each with its own set of included/excluded fields and filters. Reference a policy by name when executing a query.

  • NuGet package:
  • Source code:

Demo Project

A complete demo using the AdventureWorks 2022 database is available. Clone the repository and run the demo to see Kepler.Core in action:

git clone https://github.com/MohammadAliEbrahimzadeh/Kepler.Core.git
cd Kepler.Core/Demo
dotnet run

Contributing & Feedback

If you find Kepler.Core useful, please ⭐ the repository. For issues, suggestions, or contributions, open an issue or pull request on GitHub. Your feedback is welcome.

Back to Blog

Related posts

Read more »

Domina el uso de paquetes NuGet en .NET

¿Qué es realmente NuGet? Imagina que NuGet es el Amazon o Mercado Libre de .NET. Tú no fabricas cada tornillo de tu mueble; los pides a la tienda. - El Package...