203 questions
48
votes
1
answer
52k
views
Postgres Npgsql Connection Pooling
I'd like to better understand Connection Pooling when using Npgsql for Postgres. (http://www.npgsql.org/)
When I use the connection string:
UserID=root;Password=myPassword;Host=localhost;Port=5432;...
5
votes
3
answers
6k
views
How to resolve .net core build error NETDSDK1061 and warning MSB3277
I´ve had the problem, that my AspNetCore.App-metapackage referenced a lower Version of EntityFrameworkCore (2.1.2), than a EfCore provider package (NpgSql, referencing 2.1.3). The result was the ...
114
votes
15
answers
177k
views
.NET6 and DateTime problem. Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp without time zone'
I have common problem.
Cannot write DateTime with Kind=UTC to PostgreSQL type 'timestamp
without time zone'
And I want to enable Legacy Timestamp behavoour as is documented here:
https://github.com/...
9
votes
7
answers
27k
views
Case insensitive name of tables and properties in Entity Framework 7
I use Entity Framework 7 with Npgsql adapter. Sql generated by EF seems like
SELECT "r"."Id", "r"."Name" FROM "public"."Role" AS "r"
and it doesn't work in Postgres, because case-sensitive policy. To ...
6
votes
3
answers
16k
views
how can I get cursor data with calling stored procedure in npgsql
I have looked into materials in www.npgsql.org, but couldn't find how to solve my problem...
Table, PostgreSQL
[City], [State]
"Austin", "TX"
"Houston", "TX"
"Los Angeles", "CA"
"San Diego", "CA"
"...
10
votes
4
answers
22k
views
Retrieve serial ID with Npgsql when inserting with ExecuteScalar
I'm trying to insert a row into a PostgreSQL table with a serial primary key and I need to retrieve this column after it was inserted. I got something like this:
The table "pais" has 3 columns: id, ...
6
votes
5
answers
7k
views
Using npgsql 12 and ef 6 together - have anyone succeeded with it? [closed]
I'm trying to create a small POC for my boss about the hybrid of npgsql 12 and ef6,
created a new project on visual studio
created a sample database
created the corresponding classes and the dbcontext
...
5
votes
1
answer
4k
views
Dapper parameters not working with PostgreSQL through npgsql connection, is postgres anonymous function parameterization supported?
I'm trying to use dapper to parameterize a postgres anonymous function i've written to do an upsert. Here's the code:
private static int UpsertProductPrice(
IDbConnection connection,
...
3
votes
1
answer
3k
views
How to disable MARS and circumvent "MARS is not yet implemented"-exception"?
While using a PostgreSQL database with Entity Framework on Mono using the packages Npsql and Npsql.EntityFramework I get an exception while trying to run Code First migrations from a Console app. The ...
1
vote
2
answers
7k
views
Inserting Large Object into Postgresql returns 53200 Out of Memory error
Postgresql 9.1
NPGSQL 2.0.12
I have binary data I am wanting to store in a postgresql database. Most files load fine, however, a large binary (664 Mb) file is causing problems. When trying to load ...
13
votes
2
answers
24k
views
Npgsql 4.0 Parameters and Null Values
Passing a null value using Npgsql looks something like this:
using (NpgsqlCommand cmd = new NpgsqlCommand("insert into foo values (:TEST)", conn))
{
cmd.Parameters.Add(new NpgsqlParameter("TEST", ...
11
votes
3
answers
23k
views
How to implement Select For Update in EF Core
As far as I've understood it, there is no option in EF (and EF Core) to explicitly lock resources which I'm querying, but I'll need this functionality quite often and don't really feel like falling ...
8
votes
1
answer
10k
views
Does Npgsql provider has support for TransactionScope?
I'm trying to use a TransactionScope with the Npgsql provider.
I found in an old question (provider for PostgreSQL in .net with support for TransactionScope) that Npgsql didn't supported it yet.
Now, ...
6
votes
3
answers
10k
views
Unable to create database in PostreSQL using Npgsql and Entity Framework code first
I am attempting to set up my application to use Entity Framework with PostgreSQL, but I have run up against a problem. I have added Npqsql via nuget, and added the following provider factory to web....
5
votes
1
answer
25k
views
INSERT data from Textbox to Postgres SQL
I just learn how to connect C# and PostgresSQL.
I want to INSERT data from tb1(Textbox) and tb2 to database. But I don't know how to code
My previous code is SELECT from database.
this is my code
...
4
votes
2
answers
24k
views
PostgreSQL: command is already in progress
My asynchronous function tries to select a single record from a table. This function accepts a few arguments passed from another function.
So, some processes (6 at least) can use it simultaneously. ...
4
votes
1
answer
3k
views
EntityFramework DbContext lifecycle + Postgres: "An operation is already in progress."
I have been messing with the following for a few days now.
I have a Nancy app running on Mono, with EntityFramework with Repository pattern and UnitOfWork, and Postgres. Nancy uses TinyIoC as it's ...
3
votes
2
answers
14k
views
statement for npgsql using parameter
I pass the parameters in the sql query using the driver npgsql:
SqlCommand = new NpgsqlCommand();
....
SqlCommand.CommandText = "SELECT id,name FROM table1 WHERE field1=:param2 ORDER BY name;";
...
3
votes
1
answer
3k
views
How to return custom table types from Npgsql and stored procedures?
I'm trying to return a custom (composite) type based on an implicit table type.
I have this table definition:
CREATE TABLE app_user (id CHAR(36) PRIMARY KEY, name TEXT);
Which is mapped to this ...
3
votes
2
answers
7k
views
C# / Postgres / FluentNHibernate : configuring npgsql throws NotSupportedException
Sometimes I really start wondering what's going on in my sourcecode:
I'm trying to connect to PostGres 9.0 using npgsql 2.0.11.0, which I'm damn sure I already did, but right now, my program throws a ...
2
votes
3
answers
8k
views
PostgreSQL data provider missing from wizard in Visual Studio 2015
I've spent a day trying to migrate an Entity Framework 6 SQL Server CE to PostgreSQL.
I've copied the database over fine, but I can't seem to get the data provider to work.
Firstly I tried the older ...
1
vote
2
answers
5k
views
Why does a query time-out when it is within it's timeout limit?
I have a long running query that times out after about 48 minutes.
The command time-out is set to 2 hours and the connection time-out is set to 17 minutes.
What would cause the query to raise a time-...
1
vote
2
answers
1k
views
Postgres Interval with Dapper & npgsql not working
I am using Dapper with Postgres npgsql and I am having trouble executing an SQL command using INTERVAL.
The command works fine outside my code.
I get the error
Npgsql.PostgresException: '42601: ...
0
votes
2
answers
3k
views
Castle Activerecord error is “relation does not exist” on Postgresql?
ActiveRecord mape:
[ActiveRecord("JobTitle",Schema="public")]
public class JobTitle :ActiveRecordValidationBase<JobTitle>
{
[PrimaryKey(Column = "Id")]
public virtual int Id { get; ...
39
votes
3
answers
57k
views
Entity Framework Core jsonb column type
I am using Entity Framework Core with npgsql postgresql for Entity Framework Core.
My question is, using migrations, how do I mark a class property to generate a JSONB column type?
For example:
...