Database.ADO
0.1.3
See the version list below for details.
dotnet add package Database.ADO --version 0.1.3
NuGet\Install-Package Database.ADO -Version 0.1.3
<PackageReference Include="Database.ADO" Version="0.1.3" />
paket add Database.ADO --version 0.1.3
#r "nuget: Database.ADO, 0.1.3"
// Install Database.ADO as a Cake Addin #addin nuget:?package=Database.ADO&version=0.1.3 // Install Database.ADO as a Cake Tool #tool nuget:?package=Database.ADO&version=0.1.3
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": "FHCLARKSRV\\SQLEXPRESS;Initial Catalog=cfauction;Persist Security Info=false;User ID=sa;Password=DrUalcman5081;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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net7.0
- Database.Entities (>= 0.1.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- Microsoft.Extensions.Options (>= 7.0.1)
- System.Data.SqlClient (>= 4.8.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
[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.