Ado.Entity 2.4.0

dotnet add package Ado.Entity --version 2.4.0
NuGet\Install-Package Ado.Entity -Version 2.4.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="Ado.Entity" Version="2.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ado.Entity --version 2.4.0
#r "nuget: Ado.Entity, 2.4.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.
// Install Ado.Entity as a Cake Addin
#addin nuget:?package=Ado.Entity&version=2.4.0

// Install Ado.Entity as a Cake Tool
#tool nuget:?package=Ado.Entity&version=2.4.0

Ado.Entity

Ado.Entity Nuget Github MIT License Build Pass

Ado.Entity is an object-relational mapping framework for .NET applications. Object-relational mapping allows the use of database queries and operations with object-oriented programming languages. It has similarty with Entity framework But you must agree that , it is a lot simpler than Entity framework . If you don;t know about The entity , you can have a look here . Even if you are familier with Entity and trying to avoid complex Code First, Model First, and Database First approaches , you can try this .

You need to import Ado.Entity Namespace'

  using Ado.Entity.MSSql;

After Improting the namespace we need to create one POCO class which will hve same name as a table . That POCO need to inharite the class AdoBase . That class should contain properties Where Property names and Column names of the Table should be same . For Example, if we have a table called Users and it's having 5 columns "Id(int)","Name(varchar(20))","Age(int)","IsAdmin(bit)","DOB(datetime)" then the mapping poco class is


    [Table("Users")]
    class Users:AdoBase
    {
        [Primary]
        public int Id { get; set; }
        public string Name { get; set; }
        public bool IsActive { get; set; }
        public double Salary { get; set; }
        public int Age { get; set; }
        [Column("DOB")]
        public DateTime DateOfBirth { get; set; }
    }

Note : We can use attribute like , Primary , Unique for a property . One class can have only one property tith attribute primary . More then one primary attribute will throw error(runtime).

Get data from table

We need to follow very simple steps to get data from database . First we need to create a instance of Connection class where we need to pass connection string . GetDataByQuery helps to get data from table . GetDataByQuery expects sql query , which we need to pass when calling this method .

        public DbConnection()
        {
            IConnection connection = new Connection(connectionString);
            var data=connection.GetDataByQuery<Users>("select * from Users");
        }

Update row(s) of a table

To update a row of the table Users first we need to create a instance of Connection class where we need to pass connection string . UpdateEntry helps to update data of a row . we need to pass an object of class "Users" in UpdateEntry . Updating multiple rows also possible here .

//single row update
        public DbConnection()
        {
            IConnection connection = new Connection(connectionString);
            //data is a object of class Users .
            connection.UpdateEntry<Users>(data);
        }
//multiple row update
        public DbConnection()
        {
            IConnection connection = new Connection(connectionString);
            //dataList is List<Users>  .
            connection.UpdateEntry<Users>(dataList);
        }

Insert row(s) in a table

To Insert a row of the table Users first we need to create a instance of Connection class where we need to pass connection string . AddEntry helps to insert a row . we need to pass an object of class "Users" in AddEntry . Adding multiple rows also possible here .

//single row Add
        public DbConnection()
        {
            IConnection connection = new Connection(connectionString);
            //data is a object of class Users .
            connection.AddEntry<Users>(data);
        }
//multiple row Add
        public DbConnection()
        {
            IConnection connection = new Connection(connectionString);
            //dataList is List<Users>  .
            connection.AddEntry<Users>(dataList);
        }

Delete row(s) from a table

To Delete a row of the table Users first we need to create a instance of Connection class where we need to pass connection string . DeleteEntry helps to delete a row . we need to pass an object of class "Users" in DeleteEntry . Deleting multiple rows also possible here .

//single row Delete 
        public DbConnection()
        {
            IConnection connection = new Connection(connectionString);
            //data is a object of class Users .
            connection.DeleteEntry<Users>(data);
        }
//multiple row Delete
        public DbConnection()
        {
            IConnection connection = new Connection(connectionString);
            //dataList is List<Users>  .
            connection.DeleteEntry<Users>(dataList);
        }

So , The concept is not new right ? Yes I know. But still if you want a light weight object-relational mapping library try this .

Example project : Code Example

Product Compatible and additional computed target framework versions.
.NET Framework net35 is compatible.  net40 was computed.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 3.5

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
2.4.0 252 5/31/2023
2.3.0 187 5/31/2023
2.1.0 330 12/23/2022
2.0.0 286 12/18/2022
1.2.0 419 9/17/2022
1.1.3 414 8/6/2022
1.1.2 378 8/6/2022
1.1.1 403 8/5/2022
1.1.0 390 8/4/2022
1.0.1 401 8/3/2022
1.0.0 402 8/3/2022

Fixing bug