Teclimit.Sql.Data.Materializer 4.0.0

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

Teclimit.Sql.Data.Materializer

A lightweight, explicit, and provider-agnostic SQL materialization framework for .NET.

Teclimit.Sql.Data.Materializer is a micro-ORM designed for developers who require full control over SQL execution, predictable behavior, and efficient entity materialization, without introducing hidden abstractions or proprietary query languages.

The framework intentionally sits between raw ADO.NET and heavyweight ORMs such as Entity Framework, offering a Dapper-like experience enhanced with hierarchical entity materialization, metadata caching, and native support for nested entities.


โœจ Key Features

  • Explicit SQL execution (Text and Stored Procedures)
  • Automatic materialization of entities (ISqlEntity)
  • Support for nested entities (flat JOINs โ†’ object graphs)
  • Thread-safe metadata caching with optimized reflection
  • Native support for SQL IN clauses with safe parameter expansion
  • SQL command logging similar to Entity Framework
  • Fully provider-agnostic (ADO.NET based)
  • Compatible with .NET Core 3.1 and later
  • Zero external dependencies
  • Distributed under the MIT License

๐Ÿ“ฆ Installation

dotnet add package Teclimit.Sql.Data.Materializer

๐Ÿš€ Basic Usage

Executing SQL Commands

materializer.ExecuteNonQuery(
    "INSERT INTO orders (id, total) VALUES (@id, @total)",
    new
    {
        id = Guid.NewGuid(),
        total = 150.75m
    }
);

Querying Entities

var orders = materializer.Query<Order>(
    "SELECT id, total FROM orders WHERE total > @min",
    new { min = 100 }
);

Native IN Clause Support

var orders = materializer.Query<Order>(
    "SELECT * FROM orders WHERE id IN (@ids)",
    new
    {
        ids = new[] { id1, id2, id3 }
    }
);

The framework automatically expands the query into:

WHERE id IN (@ids_0, @ids_1, @ids_2)

Each value is bound as an individual parameter, ensuring safety and compatibility across providers.


๐Ÿงฑ Defining Entities

Simple Entity

[SqlEntity]
public class Order : ISqlEntity
{
    [SqlField]
    public Guid Id { get; set; }

    [SqlField]
    public decimal Total { get; set; }
}

Nested Entities (Flat JOINs)

[SqlEntity]
public class Order : ISqlEntity
{
    [SqlField]
    public Guid Id { get; set; }

    [SqlEntity(PrimaryKey = "Id")]
    public Customer Customer { get; set; }
}

The materializer automatically constructs the object graph when the related data is present, preventing the creation of empty nested objects when LEFT JOINs return null values.


๐Ÿ”„ Transactions

materializer.OpenConnection();
materializer.BeginTransaction(IsolationLevel.ReadCommitted);

try
{
    materializer.ExecuteNonQuery(...);
    materializer.ExecuteNonQuery(...);

    materializer.CommitTransaction();
}
catch
{
    materializer.RollbackTransaction();
    throw;
}

๐Ÿ“ SQL Command Logging

--------------------------------------------------
Executing DbCommand

SELECT * FROM orders WHERE id IN (@ids_0, @ids_1)

Parameters:
  @ids_0 = 'a3f9...' (Guid)
  @ids_1 = 'b4c1...' (Guid)
--------------------------------------------------

๐ŸŽฏ Design Philosophy

Teclimit.Sql.Data.Materializer is built around the following principles:

  • SQL should remain explicit and visible
  • Developers must retain full control over execution
  • No hidden behaviors or implicit query generation
  • Performance, predictability, and transparency over convenience
  • ADO.NET as a solid and proven foundation

๐Ÿงฉ Provider Compatibility

  • Microsoft SQL Server
  • PostgreSQL
  • MySQL
  • Oracle
  • Any ADO.NET-compatible data provider

๐Ÿ“„ License

This project is licensed under the Apache License 2.0. See the LICENSE and NOTICE files for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Marcelo Matos - TecLimit Digital Solutionsยฎ

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • net10.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
4.0.0 276 12/17/2025
3.0.0 289 12/16/2025
2.0.0 221 12/15/2025
1.0.0 218 12/14/2025

- (4.0.0) Adicionado Builder para facilitar construção de filtros nas consultas SQL.