Silk.Data.SQL.Postgresql
0.1.2.2
dotnet add package Silk.Data.SQL.Postgresql --version 0.1.2.2
NuGet\Install-Package Silk.Data.SQL.Postgresql -Version 0.1.2.2
<PackageReference Include="Silk.Data.SQL.Postgresql" Version="0.1.2.2" />
paket add Silk.Data.SQL.Postgresql --version 0.1.2.2
#r "nuget: Silk.Data.SQL.Postgresql, 0.1.2.2"
// Install Silk.Data.SQL.Postgresql as a Cake Addin
#addin nuget:?package=Silk.Data.SQL.Postgresql&version=0.1.2.2
// Install Silk.Data.SQL.Postgresql as a Cake Tool
#tool nuget:?package=Silk.Data.SQL.Postgresql&version=0.1.2.2
Overview
Postgresql provider for Silk.Data.SQL.Base
.
Installing
Silk.Data.SQL.Postgresql
is available as a NuGet package: https://www.nuget.org/packages/Silk.Data.SQL.Postgresql
You can install it from the NuGet package manager in Visual Studio or from command line with dotnet core:
dotnet add package Silk.Data.SQL.Postgresql
Usage
To execute SQL statements just create an instance of PostgresqlDataProvider
, passing in the name of the file you wish to store your database in.
var provider = new PostgresqlDataProvider("hostname", "database", "username", "password");
Executing Queries
Non-reader queries:
provider.ExecuteNonReaderAsync(
QueryExpression.Insert(
"Accounts",
new[] { "DisplayName" },
new object[] { "John" },
new object[] { "Jane" }
)
);
Queries with results need to be disposed:
using (var queryResult = provider.ExecuteReader(
QueryExpression.Select(
new[] { Expression.Value("Hello World!") }
)))
{
Assert.IsTrue(queryResult.HasRows);
Assert.IsTrue(queryResult.Read());
Assert.AreEqual("Hello World!", queryResult.GetString(0));
}
Raw SQL
A raw SQL expression is provided on the Postgresql
helper class.
var rawSQL = Postgresql.Raw("SELECT random()");
Raw SQL expressions are safe to be used within TransactionExpression
:
var transaction = QueryExpression.Transaction(
Postgresql.Raw("SELECT date()"),
Postgresql.Raw("SELECT time()")
);
License
Silk.Data.SQL.Postgresql
is made available under the MIT license.
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.4)
- Silk.Data.SQL.Base (>= 0.1.2.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Silk.Data.SQL.Postgresql:
Package | Downloads |
---|---|
Silk.Data.SQL.ProvidersBundle
Silk.Data.SQL providers bundle, includes Sqlite3, Postgresql, MySQL/MariaDB and SQL Server support. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.2.2 | 780 | 2/26/2019 |