[greg:~] cd dev/src/csharp [greg:csharp] mkdir postgres [greg:csharp] cd postgres [greg:postgres] git clone git://github.com/franciscojunior/Npgsql2.git [greg:postgres] cd npgsql2/src [greg:src] nant . . . . . [greg:src] cd build/ms [greg:ms] gacutil -i Npgsql.dll Failure adding assembly Npgsql.dll to the cache: gac directories could not be created, possibly permission issues. [greg:ms] sudo gacutil -i Npgsql.dll Password: Installed Npgsql.dll into the gac (/Library/Frameworks/Mono.framework/Versions/2.10.8/lib/mono/gac) [greg:ms] cd ~/dev/src/csharp/postgres [greg:postgres] mcs NpgsqlUserManual.cs -r:System.Data.dll,Npgsql.dll [greg:postgres] mono NpgsqlUserManual.exe
Sunday, April 22, 2012
C#, Npgsql and Postgres
Having done some Mono C# today and created a couple of tables in a PostgreSQL database, I thought I would investigate how to access the database from the Mono C#. I found a project that provides a DB connector and I copied the sample C# source code, see the example source.