VSProject.SQLContext
5.2.1
dotnet add package VSProject.SQLContext --version 5.2.1
NuGet\Install-Package VSProject.SQLContext -Version 5.2.1
<PackageReference Include="VSProject.SQLContext" Version="5.2.1" />
<PackageVersion Include="VSProject.SQLContext" Version="5.2.1" />
<PackageReference Include="VSProject.SQLContext" />
paket add VSProject.SQLContext --version 5.2.1
#r "nuget: VSProject.SQLContext, 5.2.1"
#addin nuget:?package=VSProject.SQLContext&version=5.2.1
#tool nuget:?package=VSProject.SQLContext&version=5.2.1
What is it?
SQL Context it is microORM for easy mapping your sql queries to VB and C# classes. The library has some special features that provide the flexibility to configure the mapping:
- Custom attributes (PrimaryKey, Table, Column). Table, Column - allows you to map property names to different column names
- Mapping to .NET types, such as classes, structures and value types
- Mapping to dynamic objects
- Caching mapper functions for optimizing speed work
- The architecture is based on an interface IDbConnection, that redesign library to connect any ADO.NET data provider
How I can use ?
- Download small library from NuGet package https://www.nuget.org/packages/VSProject.SQLContext/
- Add reference in your project and import namespaces from VSProject.SQLContext.*
- Everything is ready for work
Example code
Define your class for table row
<Table("table_test")>
Public Class ClassTest
<PrimaryKey>
Public Property ID As Long
<Column("field_name")>
Public Property Name As String
<Column("field_address")>
Public Property Address As String
' This is custom user property
Public Property Phone As PhoneObject
' This is custom user property
Public Property Skype As PhoneObject
End Class
Connect to database and get each row in object class
Using context As New SQLContext(New SQLiteConnection("Data Source=C:\test.db"))
' You can read row as object class
For Each row In context.SelectRows(Of ClassTest)("select id, field_name, field_address from table_test")
Console.WriteLine($"Your record data is {row.ID}, {row.Name}, {row.Address}")
Next
' Or you can read as Dictionary(Of String, Object)
For Each row In context.SelectRows("select id, field_name, field_address from table_test")
Console.WriteLine($"Your record data is {row("id")}, {row("field_name")}, {row("field_address")}")
Next
' Or you can read as dynamic object
For Each row In context.SelectRowsDynamic("select id, field_name, field_address from table_test")
Console.WriteLine($"Your record data is {row.id}, {row.field_name}, {row.field_address}")
Next
' Or do you have full control?
Dim reader = context.ExecuteReader("select id, field_name, field_address from table_test")
End Using
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 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. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.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.
* Обновленный интерфейс мапперов, переосмыслена реализация
* Исправление ошибок и увеличение производительности в разы
* Удалены классы которые устарели и должны реализовываться пользователем
* Новый интерфейс для параметризации запросов (словарный тип или анонимный объект)
Большое количество примеров доступно в проекте NUnitAutoTest