Skip to content

Commit a494aa0

Browse files
committed
Code for Npgsql is added
1 parent 52e5bc6 commit a494aa0

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

DirectSQL/DirectSQL.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1515
</PackageReference>
16+
<PackageReference Include="Npgsql" Version="4.0.3" />
1617
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
1718
<PackageReference Include="System.Data.SQLite.Core.MSIL" Version="1.0.109" />
1819
</ItemGroup>

DirectSQL/npgsql/NpgsqlDatabase.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using System.Text;
5+
6+
using Npgsql;
7+
8+
namespace DirectSQL.Npgsql
9+
{
10+
public class NpgsqlDatabase : Database
11+
{
12+
13+
private String _npgsqlConnectionString;
14+
15+
public NpgsqlDatabase( String npgsqlConnectionString)
16+
{
17+
_npgsqlConnectionString = npgsqlConnectionString;
18+
}
19+
20+
protected override IDbConnection CreateConnection()
21+
{
22+
return new NpgsqlConnection( _npgsqlConnectionString );
23+
}
24+
25+
26+
public static NpgsqlParameter CreateSQLiteParameter(string name, object value)
27+
{
28+
return new NpgsqlParameter(name, value);
29+
}
30+
31+
}
32+
}

0 commit comments

Comments
 (0)