npgsql

Can't immediately receive multiple notifications in Npgsql

白昼怎懂夜的黑 提交于 2019-11-30 16:16:57
问题 Today i wrote the following code that works with PostgreSQL C# library named Npgsql: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Npgsql; namespace PostgreSQLNotificationsTest { class Program { static void Main(string[] args) { using (var conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=postgres;Password=my_password;Database=helper_db.psql;SyncNotification=true")) { conn.Notification += OnNotification;

Postgres bytea column is returning string (char array) instead of byte array

岁酱吖の 提交于 2019-11-30 16:00:17
问题 I have been using C# to write a concrete provider implementation for our product for different databases. W/out getting into details, one of the columns is of byte array type (bytea in postgres - due to the preferences bytea was chosen over blob). The only problem, is that it does not return same value that was inserted. When I insert Int32 ("0") I get 8 [92 and 8x 48] (instead of [0,0,0,0]). I need a performance wise solution, that will return pure bytes I have inserted, instead of ASCII

Postgres bytea column is returning string (char array) instead of byte array

江枫思渺然 提交于 2019-11-30 15:37:21
I have been using C# to write a concrete provider implementation for our product for different databases. W/out getting into details, one of the columns is of byte array type (bytea in postgres - due to the preferences bytea was chosen over blob). The only problem, is that it does not return same value that was inserted. When I insert Int32 ("0") I get 8 [92 and 8x 48] (instead of [0,0,0,0]). I need a performance wise solution, that will return pure bytes I have inserted, instead of ASCII representation of value "0" on 8 bytes. I am using Npgsql to retrive data. If someone knows solution for c

Unable to create database in PostreSQL using Npgsql and Entity Framework code first

时光怂恿深爱的人放手 提交于 2019-11-30 15:35:57
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.config : <system.data> <DbProviderFactories> <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.12.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" /> </DbProviderFactories> </system.data> With the connection string: <add name="MyDb" providerName="Npgsql" connectionString="Server

postgresql does not appear in Data Source when generating .ADO.net Entity Data Model

ぃ、小莉子 提交于 2019-11-30 14:19:35
I succeeded in accessing an existing postgresql dbase by using npgsql directly. I used for this: PostgreSQL 9.0.10 (32 bit) Visual Studio 2015 Community (64 bit) NpgSql 2.2.5 (through Manage Nuget Packages) The dbase however has 25+ tables and 400+ columns and such my intention is to to use entity framework + .ADO.net Entity Data Model to avoid having to code access to all columns. I searched and tried everything on this site, npgsql site http://www.npgsql.org/doc/ddex.html , ... but I I did not succeeded in generating an .ADO.net Entity Data Model because postgresql does not appear in Data

How to disable MARS and circumvent “MARS is not yet implemented”-exception"?

ⅰ亾dé卋堺 提交于 2019-11-30 09:24:44
问题 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 connection does work in the app and the database can be CRUD'ed programmatically. The Context class looks as follows: public class ZkContext : DbContext, IZkContext { public ZkContext() : base("ZkTestDatabaseConnection") { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { /

Npgsql integration with Entity Framework Code First

痴心易碎 提交于 2019-11-30 04:55:21
问题 I have a project using the last version of EF CF with PostgreSQL and Npgsql. My model looks like: [Table("mytable")] public class MyTable { [Column("id")] public int Id { get; set; } [Column("mycolumn")] public string MyColumn { get; set; } } And the database/tables/columns has lowercase names like: CREATE TABLE mytable { id serial, mycolumn character(50) } The Npgsql generates SQL commands with quotation marks so I must use the Data Annotations due the PostgreSQL characteristics, witch is

Unable to create database in PostreSQL using Npgsql and Entity Framework code first

时光怂恿深爱的人放手 提交于 2019-11-29 21:33:56
问题 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.config : <system.data> <DbProviderFactories> <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.12.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" /> </DbProviderFactories> <

How to disable MARS and circumvent “MARS is not yet implemented”-exception\"?

你离开我真会死。 提交于 2019-11-29 15:48:42
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 connection does work in the app and the database can be CRUD'ed programmatically. The Context class looks as follows: public class ZkContext : DbContext, IZkContext { public ZkContext() : base("ZkTestDatabaseConnection") { } protected override void OnModelCreating(DbModelBuilder modelBuilder) { // PostgreSQL uses schema public by default. modelBuilder.HasDefaultSchema("public"); } public IDbSet

Can I use Parallel.For with sql Commands?

落花浮王杯 提交于 2019-11-29 08:44:03
I have a class of range public class avl_range { public long start { get; set; } public long end { get; set; } } If I use a normal FOR works perfect, but have to wait for each command to finish and each query take 8 seconds, so 10 queries take 80 seconds. In the Parallel version If I only print the ranges works perfect, but if try to execute the command say is already in progress. {"An operation is already in progress."} How can I solve this? var numbers = new List<avl_range>(); using (var conn = new NpgsqlConnection(strConnection)) { conn.Open(); Action<avl_range> forEachLoop = number => /