LiteORM_v1 1.0.1

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

LiteORM Integration Guide

This document provides instructions for integrating the LiteORM library into your .NET application as an alternative to ADO.NET or Dapper. Follow the steps below to configure and use LiteORM effectively.

Prerequisites

  • Ensure the LiteORM library is installed in your project via NuGet.
  • A valid database connection string must be configured in your application settings.

Configuration

Add the following code to your Program.cs file to configure LiteORM as a singleton service:

var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddSingleton<ILiteORM>(provider => new LiteORMRepo(connectionString));

This code retrieves the database connection string from the configuration and registers LiteORMRepo as a singleton implementation of the ILiteORM interface.

Usage

Dependency Injection

Inject the ILiteORM interface into your repository or service class using constructor injection. Example:

private readonly ILiteORM _liteORM;

public CommonRepo(ILiteORM liteORM)
{
    _liteORM = liteORM;
}

Querying Data

Use the QueryAllAsync method to execute SQL queries and retrieve data. Below is an example of fetching a list of users based on an optional UserId parameter:

public async Task<IEnumerable<PrUser>> GetUserList(int id)
{
    var res = await _liteORM.QueryAllAsync<PrUser>(
        "SELECT * FROM User WHERE (UserId = @Id OR @Id = 0)",
        new { Id = id },
        System.Data.CommandType.Text
    );
    return res;
}

This method executes a parameterized SQL query to retrieve PrUser entities, filtering by UserId or returning all users if id is 0.

Notes

  • Ensure the connection string (DefaultConnection) is defined in your configuration file (e.g., appsettings.json).
  • The ILiteORM interface and LiteORMRepo class must be properly implemented and available in your project.
  • Always use parameterized queries to prevent SQL injection vulnerabilities.
  • For support or queries, please contact us at: dev-hemant@outlook.com
  • To submit feedback or review this package, please mail us at: dev-hemant@outlook.com
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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.1 95 8/2/2025
1.0.0 516 7/24/2025