PostgExecute.Net
1.1.0
dotnet add package PostgExecute.Net --version 1.1.0
NuGet\Install-Package PostgExecute.Net -Version 1.1.0
<PackageReference Include="PostgExecute.Net" Version="1.1.0" />
paket add PostgExecute.Net --version 1.1.0
#r "nuget: PostgExecute.Net, 1.1.0"
// Install PostgExecute.Net as a Cake Addin
#addin nuget:?package=PostgExecute.Net&version=1.1.0
// Install PostgExecute.Net as a Cake Tool
#tool nuget:?package=PostgExecute.Net&version=1.1.0
postgexecute.net
Lightweight wrapper around NpgsqlConnection
object to facilitate simple PostgreSQL
execution and data retrieval in .NET Core.
This is NOT an ORM
I repeat:
This is NOT an ORM
- There is not data conversion whatsoever. Not even
DBNull.Value
to regularnull
.
- Subseqently: there is no impedance mismatch issue.
- All read operations will serialize rows directly and only to
IDictionary<string, object>>
or proved function callback for each row (see bellow)
- or, even much, much better:
- All read operations version with lambda callback for each row
This opens up new flexibility options. Now you can:
Serialize directly to structure of your choice. No need for extra transformation step. For example dictionary of instances that has key same as your database key.
Write directly to stream, json, etc ...
Developer notes
If someone wishes to build micro-ORM Dapper
style based on this code base - he or she may freely do so as long as they give proper credits/mentions and link to this repository. And if I may suggest a name - NoORM
would be just perfect.
Current version works only with PostgreSQL
and there are no plans for now to expand to other databases.
FAQ
You can do the same stuff in dapper. With ish the same syntax. I see no point, sorry.
Can you? I don't think you can.
For example, execute something custom provided by lambda parameter on each row iteration → https://github.com/vbilopav/postgrest.net/tree/master/PostgExecute.Net#read-callback-lambda
Example:
var results = new List<IDictionary<string, object>>();
await connection.Read(
@"select * from (
values
(1, 'foo1', '1977-05-19'::date),
(2, 'foo2', '1978-05-19'::date),
(3, 'foo3', '1979-05-19'::date)
) t(first, bar, day)",
result => results.Add(result));
I don't think that Dapper can do that. And that is not the point of Dapper, it is ORM, more precisely micro ORM and as such just want to serialize your results to a class instance and that's all.
Later, you can do with your list of objects whatever you please, usually some transformation into something else or write to some stream or whatever.
This allows you skip that step and do whatever you intended in first place and that way skip one iteration that would normally happen inside Dapper.
Don't get me wrong, Dapper will still be faster for plain serialization to your IEnumerable<T>
because lambdas aren't fast and Dapper also has internal row caching. But with this, as I said you can skip at least one results iteration.
The other point of this project is that it is part of larger solution intended to work closely with PostgreSQL and as such:
it works with
NpgsqlConnection
, not withIDbConnection
interface as dapper because i wanted to make it as close to PostgreSQL as possible. And alsoSystem.Data;
is going to be redesigned soon.I want to keep number of external deps as low as possible.
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. |
.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
- Npgsql (>= 4.0.10)
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 |
---|
- Add named parameters by using named tuple params
- Remove static methods
- Split interface