Database.ADO 0.1.5

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

// Install Database.ADO as a Cake Tool
#tool nuget:?package=Database.ADO&version=0.1.5

Nuget Nuget

DigitalDoor.Database.ADO

Basic access to database using classes. But also can use direct sql queries. This ORM is only tested with MS-SQL for now.

Register ServiceProvider

// Add services to the container.
builder.Services.Configure<DatabaseOptions>(options => builder.Configuration.GetSection(DatabaseOptions.SectionName).Bind(options));
builder.Services.AddScoped<DataBaseWithADO>();

appsettings

  "DatabaseOptions": {
    "ConnectionString": "localhost\\SQLEXPRESS;Initial Catalog=databasename;Persist Security Info=false;User ID=uadminguser;Password=**********;Max Pool Size=100;",
    "Options": {
      "LogOptions": {
        "LogResults": true,
        "LogFolder": "logs"
      },
      "EnableSqlInjectionControl": true,
      "EnableCharChrControl": true
    },
    "Params": [
      {
        "ColumnName": "DefaultIndexColum",
        "Value": 1
      },
      {
        "ColumnName": "DefaultFilterColumn",
        "Value": "Some"
      }
    ]
  }

DatabaseOptions

ConnectionString ⇒ how to connect with the database using ADO. Options ⇒ How to configure DatabseWithAdo object: Options.LogOptions ⇒ Login parameters using default login. Also can use IDbLog with a personalized loger Options.LogOptions.LogResults ⇒ true to log db results. Options.LogOptions.LogFolder ⇒ folder where will store the log file using a default loger. Options.EnableSqlInjectionControl ⇒ true to prevent sql injection. Enable this not allowed comments in the SQL queries or commands. Options.EnableCharControl ⇒ If EnableSqlInjectionControl is true set to true to block use CHR in the queries or commands. Params ⇒ Enabled a default column when using class with a default value in a where if have a property match with the column name. Params = IEnumerable < ParamValue > where ParamValue { ColumnName = "PropertyName", "Value" = (object)DefaultValue }

Load data

DataTable dataTable = database.GetDataTable<Customers>();
DataSet ds = database.GetDataSet<Customers>();
DataView dv = database.GetDataView<Customers>();
List<Customers> list = database.List<Customers>();

// with pagination (startIndex =  numPage * numElements)
DataTable dataTable = database.GetDataTable<Customers>(nameof(Customers.Id), 0, 50);
DataSet ds = database.GetDataSet<Customers>(nameof(Customers.Id), 10, 50);
DataView dv = database.GetDataView<Customers>(nameof(Customers.Id), 100, 50);
List<Customers> list = database.List<Customers>(nameof(Customers.Id), 1000, 50);
Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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. 
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
0.1.5 101 2/26/2024
0.1.4 236 11/8/2023
0.1.3 108 11/1/2023
0.1.2 112 10/30/2023
0.1.1 109 10/29/2023
0.1.0 104 10/28/2023

[2024-02-26] Update System.Data.SqlClient because vulnerable version update.
 [2023-11-08] Update some improvements and readme file.
 [2023-11-01] Fixed how to calculate page in the query to set like start index and num elements. So developer need to calculate page num * num elements to get the correct range. In convination with Blazor Virtualize Component get the correct numbers.
 [2023-10-30] Fixed no get correctly the property name when is overwrite using DatabaseAttribute(Name = "") to match with table column name.
 [2023-10-29] Update READ ME and fixed null reference in loger.