PostgreSQL - In C#, NPSQL or ODBC ?

Asgorath

[H]ard|Gawd
Joined
Jul 12, 2004
Messages
1,253
I'm using PostgreSQL as a backend and writing the front end in C#. Right now I'm using the NPSQL driver as I read it is alot faster than the ODBC driver. However, the NPSQL driver doesn't integrate well with Visual Studio. So I'm wondering if slower development is worth the increase in speed.

For instance, let's say I have a form with a text box on it. If I want to pull the text data from that text box and pass it to a SQL function that is expecting a string, I have to mark it up with surrounding quotes and all that using C# string processing. It's a real pain. I would rather just pass the text box data right into the sql function and be done with it. It makes for messy code.

Do you guys have some recommendations for me?
 
Why not wrap your calls to the database stored procedcures in a data access class, and wrap the strings in quotes there?
 
Why not wrap your calls to the database stored procedcures in a data access class, and wrap the strings in quotes there?
+1 ... Write up a data access layer that handles the DB communication, then call that layer from a business layer that has the stored proc names, takes parameters, returns data, etc. You can add additional layers in between as needed for implementing data flows across infrastructure, using business objects (instead of datatables/datasets), and scaling however needed.

However, the free Microsoft Enterprise Library does come with many common code blocks, and its open source nature has been tested by tons of developers. I think what you'll focus on would be the DAAB (data access application blocks). Tons of tutorials are out there as well, searches on MSDN and Google are your friend.
*** This may help cut down your development time, allowing you to focus more on stored procs and business rules, instead of developing a data access tier and managing database connections.

The DAAB blocks you would use, of course, would be ODBC objects/connections. I'm not familiar with the performance differences between NPSQL and the ODBC.Net objects, and its relevance may be subjective depending on how many transactions per minute/hour/day that has yet to be mentioned.
 
I think that it would be smart to convert over to standard MS ODBC layer. Then that Enterprise library would be even nicer to use.

Thanks for the heads up on that. That will make lots of stuff nicer to deal with.
 
Back
Top