tag:blogger.com,1999:blog-152379202024-03-19T06:54:04.686-03:00Francisco Figueiredo Jr ActivitiesI'm a software engineer and creator of <a href="http://www.npgsql.org">Npgsql</a>. <br>
Here you will find info about me and the development projects I work on<br>
If you liked this blog, you should follow me on <a href="http://www.twitter.com/franciscojunior">twitter</a>
<br>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.comBlogger134125tag:blogger.com,1999:blog-15237920.post-6384849385304864832022-05-18T08:30:00.062-03:002022-05-18T08:30:00.168-03:00Happy 20th Anniversary, Npgsql!<p> </p><h2 style="text-align: left;"><span><span> </span>Happy 20th Anniversary, Npgsql!</span></h2><p style="text-align: justify;"><span><span> </span></span></p><p style="text-align: justify;"><span><span><span> </span>It seems like yesterday when I decided to </span>start Npgsql. And today, Npgsql completes 20 years since the first public beta release!</span></p><p style="text-align: justify;"><span><span> </span>On May 18th, 2002, this is what was written in the first release notes of Npgsql version 0.1:</span></p><p style="text-align: justify;"><span></span></p><p><span><span> </span></span></p><p><span style="font-size: small;"><span><span><span style="font-family: courier;">2002-05-18<br /> <br /> First Npgsql beta release.<br /> In this version there is a limited functionality. It is only possible to connect and disconnect from server.<br /> Only clear text authentication is supported right now.<br /> To compile you can use the SharpDevelop to open the Combine file (Npgsql.cmbx) or<br />type at command console: csc /t:library /out:Npgsql.dll NpgsqlConnection.cs AssemblyInfo.cs NpgsqlException.cs<br />This will create the file Npgsql.dll that can be copied to the application directory.<br /><br /> I will be working in the Command functionality now.<br /> <br /> <br /> Play with it and send your bugs and comments :)<br /> (fxjr)</span> <br /></span></span></span></p><p><span><span><span style="font-size: small;"></span><span> </span></span></span></p><p><span><span><span><span> </span></span></span>It's been a long journey since then. And what a journey!! :)<br /></span></p><p style="text-align: justify;"><span><span> </span>It all started when I decided to contribute to the open source community after so much time learning from it.</span></p><p style="text-align: justify;"><span><span> </span>At the time, ( year 2002 ), .Net was in its infancy but it looked very promising. Then I decided to create this new project in C#.</span></p><p style="text-align: justify;"><span><span> </span>As I wanted to play with network protocols and I also enjoyed working with databases, I started to check if there were .Net Data Providers for some open source database servers. I ended up picking Postgresql because <a href="https://www.postgresql.org/docs/current/protocol.html" target="_blank">the communication protocol was very well documented</a>.</span></p><p style="text-align: justify;"><span><span> To me, this project is the most important contribution I have ever made to the opensource community. I'm very proud of it! :)<br /></span></span></p><p style="text-align: justify;"><span><span><span> </span>I'm specially happy because since the beginning, Npgsql is like a reference in the .Net world when talking about connecting to Postgresql.</span> </span></p><p style="text-align: justify;"><span><span> Of course, all this wouldn't be possible without the help of a lot of people. </span>I'd like to thank everybody who helped to make Npgsql the success it is today! </span></p><p style="text-align: justify;"><span><b><span> </span>Thank you! </b><br /></span></p><p style="text-align: justify;"><span><span> </span>Here is a list ( I know it is far from complete, sorry if I missed your name ) of some persons who helped Npgsql to be what it is today: ( I took most of this list from <a href="https://github.com/franciscojunior/Npgsql1" target="_blank">Npgsql1 repository</a> ):<br /></span></p><p style="text-align: justify;"><span><span></span></span></p><ul style="text-align: left;"><li><span>Dave Page - He was like a mentor for me in the early days. Helped me a lot how to manage an opensource project. <br /></span></li><li><span>Josh Cooley - He made a lot of contributions and also <a href="https://www.pgcon.org/2008/schedule/events/66.en.html" target="_blank">made a presentation of Npgsql with me at PGCon 2008!</a><br /></span></li><li><span>Brar Piening</span></li><li><span>Hiroshi Saito - He also <a href="https://www.pgcon.org/2008/schedule/events/66.en.html" target="_blank">made a presentation of Npgsql with me at PGCon 2008!</a><br /></span></li><li><span>Daniel Morgan</span></li><li><span>Ben Clewett</span></li><li><span>Ulrich Sprick</span></li><li><span>Jon Asher</span></li><li><span>Chris Morgan</span></li><li><span>Thilo Utke<br /></span></li><li><span>Glen Parker</span></li><li><span>Shay Rojansky - who is helping taking Npgsql to levels that I never thought </span><span></span>was possible!<br /></li></ul><p style="text-align: justify;"><span><span> So, that's it. I just wanted to create a special post for this day!<br /></span></span></p><p style="text-align: justify;"><span><span><span> </span>Thank you all for reading this far. I'll make some other posts talking about Npgsql history. </span><br /></span></p>Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-70091475064275625862020-03-01T17:16:00.000-03:002020-03-01T17:16:24.858-03:00It's been a long time....Hi, all!!<br />
<br />
<div style="text-align: justify;">
It's been a long time since the last time I posted here... Wow, almost 6 years!! </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
What have I been doing all this time, you may wonder...
Well, I've been studying a lot and playing with other projects besides Npgsql, which btw is in excellent <a href="https://github.com/roji">Shay Rojansky's</a> hands. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So, what I've been up to, you may ask? Well... I've been playing with mobile development. More specifically Android Development. And I've already published some apps to Play Store. I'll talk more about them in future posts.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Just wanted to let you know that I'm back to blogging and will keep posting about my projects again. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Thanks for reading!</div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-40629783320522061372014-09-02T18:31:00.000-03:002014-09-02T18:33:34.348-03:00Npgsql 2.2.0 final release is out!<div class="markdown-body">
<h1>
This is Npgsql 2.2.0 Final Release</h1>
<br />
This release contains 249 commits since the last stable release. Includes bug fixes, improvements and new features.<br />
<br />
<b>Update notice: If you have been using Npgsql 2.2.0-rc2, you
don't need to update to this version. They are the same except for the
Assembly version information.</b><br />
<br />
<b><span style="font-size: x-large;">Major highlights</span></b><br />
<br />
<h3>
Visual Studio DDEX support</h3>
<h3>
</h3>
Kenji Uno added support for DDEX. Now you can use Npgsql with Visual
Studio data designer. This is a missing feature a lot of our users
requested in the past. Kenji added a tutorial about how to use Npgsql
with DDEX. You can find it here: <a href="https://github.com/npgsql/Npgsql/wiki/Visual-Studio-Design-Time-Support---DDEX-Provider#install-npgsqlddexprovidervsix">https://github.com/npgsql/Npgsql/wiki/Visual-Studio-Design-Time-Support---DDEX-Provider#install-npgsqlddexprovidervsix</a><br />
<h3>
</h3>
<h3>
Entity Framework</h3>
<h3>
</h3>
David Karlaš added support for EFMigration and Database creation in EF6+. <br />
Now it is possible to start Code First projects without needing to
create a database upfront. EntityFramework and Npgsql will take care of
it.<br />
<br />
Emil Lenngren added support for a lot of missing features of EntityFramework. <br />
<br />
A list containing fixes from David and Emil as well as others for EntityFramework can be seen here: <a href="https://github.com/npgsql/Npgsql/issues?direction=desc&labels=entity+framework&milestone=2&page=1&sort=created&state=closed">https://github.com/npgsql/Npgsql/issues?direction=desc&labels=entity+framework&milestone=2&page=1&sort=created&state=closed</a><br />
<h3>
</h3>
<h3>
SSLStream support</h3>
<h3>
</h3>
In this release, SSLStream is on by default. <br />
If you want to use Mono.Security, you will need to use the following line in your code:<br />
<pre><code>NpgsqlConnection.UseSslStream = false; </code></pre>
Note that in future releases, this option may not be available
anymore as we are removing the dependency on Mono.Security assembly. Let
us know in the <a href="https://groups.google.com/forum/#%21forum/npgsql-help">forums</a>
if you have any problem with ssl when using SSLStream. This will help
us check if we will be able to remove Mono.Security assembly.<br />
<h3>
</h3>
<h3>
Added support for JSON, JSONB and HSTORE datatypes</h3>
<br />
Shay added support for those datatypes. <br />
<h3>
</h3>
<h3>
Added GSSAPI support on Windows</h3>
<br />
Brian Crowell added support for GSSAPI on windows. Now it is easier to use Active Directory when authenticating users.<br />
<h3>
</h3>
<h3>
Removed support for protocol v2</h3>
<br />
Postgresql versions which use only protocol 2 are very old and don't
receive support from postgresql group anymore. By removing support for
protocol version 2, we removed a lot of code and can focus on
functionalities provided by protocol 3.<br />
<h3>
</h3>
<h3>
Removed support for Postgresql 8.4 and below</h3>
<br />
In <a href="https://groups.google.com/forum/#%21topic/npgsql-dev/omQ40Eq0HoA">this thread</a>,
we talked about making Npgsql support the officially supported
postgresql versions. we talked about making Npgsql support the
officially supported postgresql versions. Postgresql has <a href="http://www.postgresql.org/support/versioning/">a table of officially supported versions</a> and we decided to follow this table to guide us which postgresql version we will have support to.<br />
This doesn't necessarily mean that Npgsql won't work on unsupported
versions. It may work if we don't add any SQL or unsupported feature.
For example, today Npgsql 2.2 works only on Postgresql 8.2 and above
because we added server side support for command timeout handling and
some other queries which aren't supported on earlier versions.<br />
If you are using earlier postgresql versions, please, use an older
version of Npgsql. We are creating a compatibility table to show which
Postgresql version Npgsql works with.<br />
<h2>
</h2>
<h3>
Fixed bugs:</h3>
<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/pull/91" title="Support for EFMigration and Database creation">#91</a>] Support for EFMigration and Database creation<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/152" title="NpgsqlInterval different constructors different ToString">#152</a>] NpgsqlInterval different constructors different ToString<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/158" title="NpgsqlCommand.Dispose() should execute "DEALLOCATE <name>" for a prepared command">#158</a>] NpgsqlCommand.Dispose() should execute "DEALLOCATE " for a prepared command<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/177" title="XML data type doesn't seem to be quoting parameters properly on insert">#177</a>] XML data type doesn't seem to be quoting parameters properly on insert <br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/179" title="NpgsqlCommandBuilder automatic sql commands configuration">#179</a>] NpgsqlCommandBuilder automatic sql commands configuration<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/pull/188" title="Buffer too small problem in NpgsqlCopySerializer">#188</a>] Buffer too small problem in NpgsqlCopySerializer<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/201" title="Dynamic type parameters: Cannot cast System.Int32 into any valid DbType after upgrading from 2.0.14.3 to 2.1.2.0">#201</a>] Dynamic type parameters: Cannot cast System.Int32 into any valid DbType after upgrading from 2.0.14.3 to 2.1.2.0<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/208" title="ObjectDisposeException">#208</a>] ObjectDisposeException<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/217" title="Impossible to insert a Double.NaN value">#217</a>] Impossible to insert a Double.NaN value<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/219" title="[#1011005] using 2 NpgsqlCopyIn at the same time">#219</a>] [#1011005] using 2 NpgsqlCopyIn at the same time<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/223" title="HasRows doesn't work with preload reader">#223</a>] HasRows property's bug<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/231" title="NpgsqlParameterCollection.Clear() doesn't reset NpgsqlParameter.Collection">#231</a>] NpgsqlParameterCollection.Clear() doesn't reset NpgsqlParameter.Collection<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/pull/225" title="Handle IEnumerable<int> parameter">#225</a>] Handle IEnumerable parameter<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/233" title="Cannot insert to tables which have only one column">#233</a>] Cannot insert to tables which have only one column<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/246" title="Take followed by Skip is generated incorrectly in Entity Framework">#246</a>] Take followed by Skip is generated incorrectly in Entity Framework<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/262" title=" FirstOrDefault() on navigation property subquery throws “Not Implemented” Exception">#262</a>] FirstOrDefault() on navigation property subquery throws “Not Implemented” Exception<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/264" title="Mono.Security is outdated">#264</a>] Mono.Security is outdated<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/pull/269" title="Fix 's' value mapped to the 'a' byte">#269</a>] Fix 's' value mapped to the 'a' byte<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/280" title="Bad SQL produced when selecting a field that was also used in the orderBy of a let subquery">#280</a>] Bad SQL produced when selecting a field that was also used in the orderBy of a let subquery<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/pull/287" title="Fix operator handling and date functions for EF">#287</a>] Fix operator handling and date functions for EF<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/296" title="parameter parsing fails (regression)">#296</a>] parameter parsing fails (regression) and duplicate [<a class="issue-link" href="https://github.com/npgsql/Npgsql/issues/240" title="NpgSqlCommand does not substitute parameters when there is a string with escaped apostrophe">#240</a>] NpgSqlCommand does not substitute parameters when there is a string with escaped apostrophe<br />
[<a class="issue-link" href="https://github.com/npgsql/Npgsql/pull/315" title="Fix query parameter processing to more correctly match PostgreSQL's lexer">#315</a>] Fix query parameter processing to more correctly match PostgreSQL's lexer<br />
A list of the issues and pull requests merged for this release can be found at github here: <a href="https://github.com/npgsql/Npgsql/issues?direction=desc&milestone=2&page=1&sort=created&state=closed">https://github.com/npgsql/Npgsql/issues?direction=desc&milestone=2&page=1&sort=created&state=closed</a><br />
<h2>
</h2>
<h3>
Known Issues</h3>
<br />
There are some issues we are working for the next maintenance release 2.2.1. You can check which issues we are working on here: <a href="https://github.com/npgsql/Npgsql/issues?q=milestone%3A2.2.1">https://github.com/npgsql/Npgsql/issues?q=milestone%3A2.2.1</a><br />
<h3>
</h3>
<h3>
Thanks</h3>
<br />
I'd like to give a special thanks to Kenji Uno for his excellent work
with Npgsql DDEX support. DDEX support was one of the biggest missing
features of Npgsql.<br />
I'd like to thank Emil Lenngren for all his work with Entity
Framework improvements and insightful comments, David Karlaš for his
help with Entity Framework support. Shay Rojansky, Glen Parker and Josh
Cooley for all contributions and comments, and a big thanks to all the
other contributors who helped us to make this release.<br />
<h4>
</h4>
<h2>
<span style="font-size: large;">Downloads</span></h2>
<div style="text-align: justify;">
Downloads are available on <a href="https://www.nuget.org/packages/Npgsql/2.2.0">Nuget</a>, <a href="https://github.com/npgsql/Npgsql/releases/tag/v2.2.0">github</a> and <a href="http://pgfoundry.org/frs/?group_id=1000140&release_id=2100">pgfoundry</a>.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Please, give it a try and let us know what you think. Drop by our <a href="https://groups.google.com/forum/#%21forum/npgsql-help">user forums</a> to discuss or send your bug reports to our <a href="https://github.com/npgsql/Npgsql/issues?state=open">issues section</a> on github. </div>
<h4>
</h4>
<h4>
List of contributors for this release</h4>
<br />
Kenji Uno<br />
Shay Rojansky<br />
Glen Parker<br />
Emil Lenngren<br />
David Karlaš<br />
Brian Crowell<br />
danzel<br />
Tuan Nguyen<br />
windcloud<br />
asgeirh<br />
Frans Bouma<br />
Jaspalsinh Chauhan<br />
Josh Cooley<br />
Martin Willey<br />
Francisco Figueiredo Jr.<br />
shankbond<br />
Javier Torres<br />
Kevin Pullin<br />
Michael de Lang<br />
Oskar Gewalli<br />
Sunny Ahuwanya<br />
Thomas Radioyes<br />
javitonino<br />
mw<br />
samy</div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com15tag:blogger.com,1999:blog-15237920.post-46264971096648912322014-08-05T18:01:00.001-03:002014-08-05T18:01:57.364-03:00Npgsql 2.2.0 Release Candidate 1 released!This release contains 22 commits since the last release. It contains the following bug fixes:<br />
<br />
[<a class="issue-link" data-mce-href="https://github.com/npgsql/Npgsql/issues/217" href="https://github.com/npgsql/Npgsql/issues/217" title="Impossible to insert a Double.NaN value">#217</a>] Impossible to insert a Double.NaN value<br /> [<a class="issue-link" data-mce-href="https://github.com/npgsql/Npgsql/issues/179" href="https://github.com/npgsql/Npgsql/issues/179" title="NpgsqlCommandBuilder automatic sql commands configuration">#179</a>] NpgsqlCommandBuilder automatic sql commands configuration<br /> [<a class="issue-link" data-mce-href="https://github.com/npgsql/Npgsql/issues/158" href="https://github.com/npgsql/Npgsql/issues/158" title="NpgsqlCommand.Dispose() should execute "DEALLOCATE <name>" for a prepared command">#158</a>] NpgsqlCommand.Dispose() should execute "DEALLOCATE " for a prepared command<br /> [<a class="issue-link" data-mce-href="https://github.com/npgsql/Npgsql/issues/264" href="https://github.com/npgsql/Npgsql/issues/264" title="Mono.Security is outdated">#264</a>] Mono.Security is outdated<br /> [<a class="issue-link" data-mce-href="https://github.com/npgsql/Npgsql/issues/296" href="https://github.com/npgsql/Npgsql/issues/296" title="parameter parsing fails (regression)">#296</a>] parameter parsing fails (regression) and duplicate [<a class="issue-link" data-mce-href="https://github.com/npgsql/Npgsql/issues/240" href="https://github.com/npgsql/Npgsql/issues/240" title="NpgSqlCommand does not substitute parameters when there is a string with escaped apostrophe">#240</a>] NpgSqlCommand does not substitute parameters when there is a string with escaped apostrophe<br />
<br />
A complete list of commits for this release can be found here: <a class="commit-link" data-mce-href="https://github.com/npgsql/Npgsql/compare/v2.2.0-beta1...release-2.2.0" href="https://github.com/npgsql/Npgsql/compare/v2.2.0-beta1...release-2.2.0"><tt>v2.2.0-beta1...release-2.2.0</tt></a><br />
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-13488866411118561782014-08-01T17:21:00.001-03:002014-08-01T17:21:04.708-03:00Npgsql 2.2.0 beta1 released!<div style="text-align: justify;">
The Npgsql Development team is proud to announce that Npgsql 2.2.0 beta1 is now available!</div>
<div style="text-align: justify;">
<br />
This release has the following highlights:<br />
<br />
<br />
<h2>
<span style="font-size: x-large;">Visual Studio DDEX support</span></h2>
<br />
Kenji Uno <a href="https://github.com/npgsql/Npgsql/pull/213">added</a> support for DDEX. Now you can use Npgsql with Visual Studio data designer. This is a missing feature a lot of our users requested in the past. Kenji added a tutorial about how to use Npgsql with DDEX. You can find it <a href="https://github.com/npgsql/Npgsql/wiki/Visual-Studio-Design-Time-Support---DDEX-Provider#install-npgsqlddexprovidervsix">here</a>. <br />
<br />
<h2>
<span style="font-size: x-large;"></span></h2>
<br />
<h2>
<span style="font-size: x-large;">Support for EFMigration and Database creation in EF6+</span></h2>
David Karlaš <a href="https://github.com/npgsql/Npgsql/pull/91">added</a> support for that. Now it is possible to start Code First projects without needing to create a database upfront. EntityFramework and Npgsql will take care of it.<br />
<br />
Emil Lenngren added support for a lot of missing features of EntityFramework.<br />
<br />
Check out <a href="https://github.com/npgsql/Npgsql/issues?direction=desc&labels=entity+framework&milestone=2&page=1&sort=created&state=closed">this list</a> containing fixes from David and Emil as well as others for EntityFramework.<br />
<br />
<h2>
<span style="font-size: x-large;">SSLStream support</span></h2>
<br />
In this release, SSLStream is on by default.<br />
<br />
If you want to use Mono.Security, you will need to use the following line in your code:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">NpgsqlConnection.UseSslStream = false;</span><br />
<br />
Note that in future releases, this option may not be available anymore as we are removing the dependency on Mono.Security assembly. Let us know in the forums if you have any problem with ssl when using SSLStream. This will help us check if we will be able to remove Mono.Security assembly.<br />
<br />
<h2>
<span style="font-size: x-large;">Added support for JSON, JSONB and HSTORE datatypes</span></h2>
<br />
Shay <a href="https://github.com/npgsql/Npgsql/commit/bfa1e6d3377a5ad8fd01e738fc4dbde7b9099148">added</a> <a href="https://github.com/npgsql/Npgsql/commit/22e4fdb3a3dd171a2ed71ca087fd16f48dd560a7">support</a> for those datatypes.<br />
<br />
<h2>
<span style="font-size: x-large;">Added GSSAPI support on Windows</span></h2>
<br />
Brian Crowell <a href="https://github.com/npgsql/Npgsql/pull/170">added</a> support for GSSAPI on windows. Now it is easier to use Active Directory when authenticating users.<br />
<br />
<br />
<h2>
<span style="font-size: x-large;">Removed support for protocol v2</span></h2>
<br />
Postgresql versions which use only protocol 2 are very old and don't receive support from postgresql group anymore. By removing support for protocol version 2, we removed a lot of code and can focus on functionalities provided by protocol 3.<br />
<br />
<br />
<h2>
<span style="font-size: x-large;">Removed support for Postgresql 8.3 and below</span></h2>
<br />
In <a href="https://groups.google.com/forum/#!topic/npgsql-dev/omQ40Eq0HoA">this thread</a>, we talked about making Npgsql support the officially supported postgresql versions. Postgresql has <a href="http://www.postgresql.org/support/versioning/">a table of officially supported versions</a> and we decided to follow this table to guide us which postgresql version we will have support to.<br />
This doesn't necessarily mean that Npgsql won't work on unsupported versions. It may work if we don't add any SQL or unsupported feature. For example, today Npgsql 2.2 works only on Postgresql 8.2 and above because we added server side support for command timeout handling and some other queries which aren't supported on earlier versions.</div>
If you are using earlier postgresql versions, please, use an older version of Npgsql. We are creating a compatibility table to show which Postgresql version Npgsql works with.<br />
<br />
<br />
<br />
Complete release notes for this release can be found on our <a href="https://github.com/npgsql/Npgsql/releases/tag/v2.2.0-beta1">github release page</a>.<br />
<div style="text-align: justify;">
<br />
<br />
<h2>
<span style="font-size: x-large;">Downloads</span></h2>
</div>
<div style="text-align: justify;">
Downloads are available on <a href="https://www.nuget.org/packages/Npgsql/2.2.0-beta1">Nuget</a>, <a href="https://github.com/npgsql/Npgsql/releases/tag/v2.2.0-beta1">github</a> and <a href="http://pgfoundry.org/frs/?group_id=1000140&release_id=2094">pgfoundry</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Please, give it a try and let us know what you think. Drop by our <a href="https://groups.google.com/forum/#%21forum/npgsql-help">user forums</a> to discuss or send your bug reports to our <a href="https://github.com/npgsql/Npgsql/issues?state=open">issues section</a> on github. </div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com1tag:blogger.com,1999:blog-15237920.post-72602710714465976152014-06-24T18:10:00.000-03:002014-06-24T18:10:11.626-03:00Initial Visual Studio Design time support added to master branch!<br />
<h2 style="text-align: justify;">
<span style="font-size: x-large;">Achievement unlocked!</span></h2>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
With the merge of <a href="https://github.com/npgsql/Npgsql/pull/213">Pull Request #213</a> (PR #213), <a href="https://github.com/kenjiuno">Kenji Uno</a> added support for Visual Studio Design Time also known as DDEX. </div>
<div style="text-align: justify;">
<br /></div>
<h2 style="text-align: justify;">
<span style="font-family: Georgia, Times New Roman, serif; font-size: x-large;">A most wanted feature</span></h2>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
From the statistics of pageviews I get from <a href="http://fxjr.blogspot.com.br/2011/05/npgsql-design-time-support-preview.html">a previous post</a> about design time support, I can affirm that this is a most wanted feature of Npgsql. And I'm very glad to say that Npgsql is finally having it. I'd like to thank Kenji Uno for all his hard work to make this happen. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Npgsql DDEX support is done through an extension file which can be easily installed in Visual Studio. This is a much better situation than we had before where it was needed to use an experimental instance of Visual Studio. </div>
<div>
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h2 style="text-align: justify;">
<span style="font-size: x-large;">History</span></h2>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The code started with wwindcloud in <a href="https://github.com/npgsql/Npgsql/pull/67">PR #67</a> and Kenji started to play with it and <a href="https://github.com/npgsql/Npgsql/pull/67#issuecomment-29612060">said he was working to get it usable in VS2012 and 2013</a>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Some time later, Kenji <a href="https://github.com/npgsql/Npgsql/pull/67#issuecomment-29905419">said he had some success to get Npgsql DDEX initially working</a> and <a href="https://github.com/npgsql/Npgsql/pull/67#issuecomment-30079064">started</a> <a href="https://github.com/npgsql/Npgsql/pull/67#issuecomment-30232955">to fix</a> <a href="https://github.com/npgsql/Npgsql/pull/67#issuecomment-40281835">the bugs he was finding</a>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In order to be able to add more fixes to the code, <a href="https://github.com/npgsql/Npgsql/pull/67#issuecomment-40544204">Kenji started the PR 213</a> and started <a href="https://github.com/npgsql/Npgsql/pull/213/commits">to add more features and fixes</a> until now when we merged all the changes back to master branch.</div>
<div style="text-align: justify;">
<br /></div>
<h2 style="text-align: justify;">
<span style="font-size: x-large;">How to use it</span></h2>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Kenji Uno <a href="https://github.com/npgsql/Npgsql/wiki/Visual-Studio-Design-Time-Support---DDEX-Provider">wrote a tutorial</a> about how to build and use this feature. Below are some screenshots from the tutorial.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Please, give it a try and let us know if it works for you. Remember that this is a work in progress, so you may face bugs and problems. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I'd like to thank Kenji Uno for all his hard work to get this feature working. And also thank wwindcloud for the initial work.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h2 style="text-align: justify;">
<span style="font-size: x-large;">Sample screenshots</span></h2>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Here is an screenshot when you double click the .vsix file to install the extension:</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cloud.githubusercontent.com/assets/5955540/3350448/c8a9152a-f9b0-11e3-8b0e-e3f3c7b06405.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://cloud.githubusercontent.com/assets/5955540/3350448/c8a9152a-f9b0-11e3-8b0e-e3f3c7b06405.png" width="320" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cloud.githubusercontent.com/assets/5955540/3350449/d22be370-f9b0-11e3-84df-2c527b3a370c.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://cloud.githubusercontent.com/assets/5955540/3350449/d22be370-f9b0-11e3-84df-2c527b3a370c.png" width="320" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
When you install it, you will be able to select it when creating a new data source connection:</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cloud.githubusercontent.com/assets/5955540/3350461/20d9fc18-f9b2-11e3-8ae8-9f3c8d44213e.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="186" src="https://cloud.githubusercontent.com/assets/5955540/3350461/20d9fc18-f9b2-11e3-8ae8-9f3c8d44213e.png" width="320" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://cloud.githubusercontent.com/assets/5955540/3350463/3607b562-f9b2-11e3-879e-213bc95fb497.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://cloud.githubusercontent.com/assets/5955540/3350463/3607b562-f9b2-11e3-879e-213bc95fb497.png" width="228" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h2 style="text-align: justify;">
<br /></h2>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-22076783342153422952014-04-09T18:13:00.000-03:002014-04-09T18:13:20.707-03:00Npgsql 2.1.3 released!<br />
This version restores the <a href="https://github.com/npgsql/Npgsql/pull/135">@@ operator support</a> removed in the previous version. Thanks Glen Parker who provided a fix.<br />
<br />
Downloads can be found at the usual locations:<br />
<br />
<a href="https://github.com/npgsql/Npgsql/releases/tag/v2.1.3">github download page</a><br />
and<br />
<a href="https://www.nuget.org/packages/Npgsql/2.1.3">the nuget repository</a>.<br />
<br />
Pgfoundry will be updated soon.Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com2tag:blogger.com,1999:blog-15237920.post-82453244894242172322014-03-27T23:34:00.000-03:002014-03-27T23:34:06.177-03:00Npgsql 2.1.2 released!Npgsql 2.1.2 is out!<br />
<br />
This is a bug fix release. Two fixes are present:<br />
<br />
<br />
<ul>
<li><a href="https://github.com/npgsql/Npgsql/issues/165">KeyNotFoundException when setting ApplicationName on NpgsqlConnectionStringBuilder</a> and </li>
<li><a href="https://github.com/npgsql/Npgsql/issues/193">A regression when using NHibernate with queries containing '<' operator.</a> (Less Than' prepare failing). Unfortunately, this fix breaks previous support for @@ operators. So if you need this support, you will have to use the previous 2.1.1 version. Glen Parker is working in a permanent fix. Sorry for this big inconvenience. More info about that can be found at the link above.</li>
</ul>
<div>
<br /></div>
<div>
Please, give it a try and let me know if you have any problems. Please, report your issues in our <a href="https://github.com/npgsql/Npgsql/issues/">github issues page</a>.</div>
<br />
<br />
<br />Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-42435566623636106872014-03-19T17:33:00.000-03:002014-03-19T17:36:04.922-03:00Npgsql 2.1.0 released!<div style="text-align: justify;">
After a long time, Npgsql 2.1.0 is finally released! </div>
<div style="text-align: justify;">
<br />
If you have been following my posts about Npgsql 2.1 <a href="http://fxjr.blogspot.com.br/2014/02/how-to-get-npgsql-210-beta.html">beta</a> and <a href="http://fxjr.blogspot.com.br/2014/02/npgsql-21-release-candidate-1-released.html">rc</a> releases, you know we did a lot of changes since our last stable release.<br />
<br /></div>
<div style="text-align: justify;">
The change log for this version is big. You can find a complete list of what has changed and the bugs fixed in the <a href="https://github.com/npgsql/Npgsql/releases/tag/v2.1.0">github project release page</a>. It has a lot of information about the changes we made since our last stable 2.0.14 release. You should check it out to see what changed and what new features you will get when you use 2.1.</div>
<div style="text-align: justify;">
<br />
Developers using Npgsql 2.1 and Entity Framework should pay attention to the changes related to new configuration settings. More information about those changes can be checked <a href="http://fxjr.blogspot.com.br/2014/02/using-entity-framework-6-with-npgsql-210.html">here</a>.<br />
<br /></div>
<div style="text-align: justify;">
Downloads are available on <a href="https://www.nuget.org/packages/Npgsql/2.1.0">Nuget</a>, <a href="https://github.com/npgsql/Npgsql/releases/tag/v2.1.0">github</a>. pgfoundry downloads will be made available soon.</div>
<div style="text-align: justify;">
<br />
Finally, I'd like to thank some people who did an incredible job and that without them this release wouldn't be possible!<br />
<br />
Glen Parker has been working in the optimizations tasks since his first git commit. From the changelog you can see his tireless work regarding each part of Npgsql which could be optimized. Thank you very much for your contributions, Glen!<br />
<br />
Shay Rojansky has been helping as the mastermind of the project restructuring support. He contributed a lot of changes which made our lives working with Npgsql much better. Thanks to him we can compile Npgsql for different .net platform versions easily. He also got TeamCity build server working as well as github integration. He helped us to get EntityFramework pre-6 and pos-6 verions easily integrated.<br />
Thank you, Shay!<br />
<br />
And Dave Page who helped us with the server where the TeamCity is installed. Without his help, I'm sure our TeamCity installation would be much more difficult. Thank you, Dave!<br />
<div>
<br /></div>
<br /></div>
<div style="text-align: justify;">
Please, give it a try and let us know what you think. Drop by <a href="https://groups.google.com/forum/#!forum/npgsql-help">Npgsql user forums</a> to discuss and comment or send your bug reports to our <a href="https://github.com/npgsql/Npgsql/issues">issues section on github</a>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com1tag:blogger.com,1999:blog-15237920.post-6846167090156493482014-02-25T21:43:00.000-03:002014-02-25T21:43:48.369-03:00Npgsql 2.1 Release Candidate 1 released!<div style="text-align: justify;">
Today we released Npgsql 2.1 RC1. This release has very few fixes since Beta1. In fact, only two:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Fixed bugs:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
#141 AlwaysPrepare does not works in some cases. Thanks @avb1987.</div>
<div style="text-align: justify;">
#153 Fixed wrong comma putting in AddFunctionColumnListSupport(). Thanks @tyler-nguyen.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<a href="https://github.com/npgsql/Npgsql/releases/tag/v2.1.0-beta1">The changelog of the Beta1</a> is way bigger and has a lot of information about the changes we made since our last stable 2.0.14 release. You should check it out to see what changed and what new features you will get when you use 2.1.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
We will have the final version release in the beginning of March.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Downloads are available on Nuget, github and pgfoundry. You may want to check my <a href="http://fxjr.blogspot.com.br/2014/02/how-to-get-npgsql-210-beta.html">previous post</a> about how to get Npgsql 2.1 beta1. The instructions there also apply to 2.1 rc1.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Please, give it a try and let us know what you think. Drop by our <a href="https://groups.google.com/forum/#!forum/npgsql-help">user forums</a> to discuss or send your bug reports to our <a href="https://github.com/npgsql/Npgsql/issues?state=open">issues section</a> on github. </div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-78533097872765443782014-02-20T09:15:00.001-03:002014-02-20T09:15:57.354-03:00How to get Npgsql 2.1.0 beta<div style="text-align: justify;">
In <a href="http://fxjr.blogspot.com.br/2014/02/using-entity-framework-6-with-npgsql-210.html">my last post</a>, I talked about how to use Npgsql 2.1.0 and showed an App.config file which you could use as a template for your applications which use Entity Framework 6.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Npgsql 2.1.0 didn't have a stable release yet. It is currently in beta (and shortly in RC). You can download it from the following sources:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
<a href="https://www.nuget.org/packages/Npgsql">Nuget</a></h3>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
As already mentioned, Npgsql 2.1.0 didn't have a stable release yet, so you will need to ask Nuget to install a pre-release version of Npgsql. You do that with the following nuget command:</div>
<div style="text-align: justify;">
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.60000228881836px;"><br /></span></div>
<div style="text-align: justify;">
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.60000228881836px;">PM> Install-Package Npgsql -Pre</span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If you plan to use Entity Framework 6, you will also need to download the <a href="https://www.nuget.org/packages/Npgsql.EntityFramework/2.1.0-beta1">Npgsql.EntityFramework</a> assembly. This is done with the following nuget command:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.60000228881836px;">PM> Install-Package Npgsql.EntityFramework -Pre</span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If you plan to use Entity Framework 4.x, you will need to download <a href="https://www.nuget.org/packages/Npgsql.EntityFrameworkLegacy/2.1.0-beta1">Npgsql.EntityFrameworkLegacy</a>. Install it with the following nuget command:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: left;">
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.60000228881836px;">PM> Install-Package Npgsql.EntityFrameworkLegacy -Pre</span></div>
<div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
<a href="https://github.com/npgsql/Npgsql/releases">GitHub</a></h3>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can download zip files of all the assemblies for many .net platform versions in our <a href="https://github.com/npgsql/Npgsql/releases">releases page</a> at GitHub.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
PgFoundry.org</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can download zip files of all the assemblies for many .net platform versions in our <a href="http://downloads.npgsql.org/">release pages</a> at pgfoundry.org .</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com1tag:blogger.com,1999:blog-15237920.post-45830187875988763922014-02-17T16:35:00.000-03:002014-07-19T19:09:00.575-03:00Using Entity Framework 6 with Npgsql 2.1.0UPDATE (2014-05-19): Marek Beneš noticed a problem in the default connection factory config. It is fixed now. Thanks, Marek!<br />
<br />
UPDATE (2014-02-20): I created <a href="http://fxjr.blogspot.com.br/2014/02/how-to-get-npgsql-210-beta.html">a new post</a> explaining how to get Npgsql 2.1.0.<br />
<div style="text-align: justify;">
<br />
Although this post is about EF 6, I'd like to talk about our current situation to support both EF 6 and EF4.x which explain why there are some subtle changes between EF 4.x and EF 6.x App.config settings. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<h3 style="text-align: start;">
Support for EF versions 4.x and 6.x</h3>
<div>
<br /></div>
</div>
<div style="text-align: justify;">
Sometime after we started to work on Npgsql 2.1.0, we started to add code to support EF6 and decided to reorganize our Entity Framework support code. Shay <a href="https://github.com/npgsql/Npgsql/pull/110">created a pull request</a> to organize this change and isolate the EF code out of core Npgsql code. The result was the creation of two separated assemblies:</div>
<div style="text-align: justify;">
<div style="text-align: justify;">
<br /></div>
<ul>
<li>Npgsql.EntityFramework.dll <b>for EF6 and above;</b></li>
<li>Npgsql.EntityFrameworkLegacy.dll <b>for EF4.x.</b></li>
</ul>
<div>
<br />
Only when using Npgsql with EF6 you will need to reference Npgsql.EntityFramework.dll assembly. This is needed because the EF system has to find it in order to use it.<br />
<br />
<div style="text-align: justify;">
When using EF 4.x, you won't need to reference Npgsql.EntityFrameworkLegacy.dll. Npgsql will load it using reflection. You just need to make sure the assembly is located at the same place as Npgsql.dll. With this approach, using EF 4.x with 2.1.0 will be the same way as using with previous versions of Npgsql.</div>
<br />
In order to facilitate how to configure Npgsql 2.1.0 to work with EF6, I'm pasting* below an App.config template which you can use as a starting point(1).<br />
<br /></div>
<h3>
Configuration settings for EF 6</h3>
<div>
<br /></div>
<pre style="background: #fdf6e3; color: #657b83; font-family: Consolas; font-size: 13;"><span style="color: #d33682;"><<span style="color: #268bd2; font-weight: bold;">xml</span><span style="color: #d33682;"> </span>version<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">1.0</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>encoding<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">utf-8</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;">?></span>
<span style="color: #d33682;"><</span><span style="color: #268bd2; font-weight: bold;">configuration</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">configSections</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">section</span><span style="color: #d33682;"> </span>name<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">entityFramework</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>type<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework,</span></span></pre>
<pre style="background: #fdf6e3; color: #657b83; font-family: Consolas; font-size: 13;"><span style="color: #d33682;"><span style="color: #2aa198;"> Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>requirePermission<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">false</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> /></span>
<span style="color: #d33682;"> </</span><span style="color: #268bd2; font-weight: bold;">configSections</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">startup</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">supportedRuntime</span><span style="color: #d33682;"> </span>version<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">v4.0</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>sku<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">.NETFramework,Version=v4.5</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> /></span>
<span style="color: #d33682;"> </</span><span style="color: #268bd2; font-weight: bold;">startup</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">entityFramework</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">providers</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">provider</span><span style="color: #d33682;"> </span>invariantName<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">Npgsql</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>type<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">Npgsql.NpgsqlServices, Npgsql.EntityFramework</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;">></</span><span style="color: #268bd2; font-weight: bold;">provider</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> </</span><span style="color: #268bd2; font-weight: bold;">providers</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">defaultConnectionFactory</span><span style="color: #d33682;"> </span>type<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">Npgsql.NpgsqlConnectionFactory, Npgsql</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> /></span>
<span style="color: #d33682;"> </</span><span style="color: #268bd2; font-weight: bold;">entityFramework</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">system.data</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">DbProviderFactories</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">remove</span><span style="color: #d33682;"> </span>invariant<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">Npgsql</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> /></span>
<span style="color: #d33682;"> <</span><span style="color: #268bd2; font-weight: bold;">add</span><span style="color: #d33682;"> </span>name<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">Npgsql Data Provider</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>invariant<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">Npgsql</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>support<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">FF</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span>description<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">.Net Framework Data Provider for Postgresql</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> </span></span></pre>
<pre style="background: #fdf6e3; color: #657b83; font-family: Consolas; font-size: 13;"><span style="color: #d33682;"><span style="color: #d33682;"> </span>type<span style="color: #d33682;">=</span><span style="color: #93a1a1;">"</span><span style="color: #2aa198;">Npgsql.NpgsqlFactory, Npgsql</span><span style="color: #93a1a1;">"</span><span style="color: #d33682;"> /></span>
<span style="color: #d33682;"> </</span><span style="color: #268bd2; font-weight: bold;">DbProviderFactories</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"> </</span><span style="color: #268bd2; font-weight: bold;">system.data</span><span style="color: #d33682;">></span>
<span style="color: #d33682;"></</span><span style="color: #268bd2; font-weight: bold;">configuration</span><span style="color: #d33682;">></span></span></pre>
<br />
*Sorry for the bad formatting :(<br />
<br />
The most important change from previous configuration files is the <b>provider</b> entry which had its type changed from Npgsql.NpgsqlFactory to Npgsql.NpgsqlServices as well as the location of this type which used to be in the Npgsql assembly and now it is located at the Npgsql.EntityFramework assembly.<br />
<br />
With those changes, you will be able to use Npgsql 2.1.0 with EF6 without any problem.<br />
<br />
Let me know in the comments if you have any problem with those directions.<br />
<br />
In a later post I'll show a step by step on how to use Npgsql 2.1.0 with EF 6 and some exciting features we are working on: <a href="https://github.com/npgsql/Npgsql/pull/91">Support for EFMigration and Database creation</a> and <a href="https://github.com/npgsql/Npgsql/pull/160">Returning DB generated values on insert for EF </a><br />
<br />
---------------------------------<br />
<br />
1. Another option to have those configurations set up is to install the Nuget Npgsql.EntityFramework package. Shay added a script which configures the App.config file and add the needed entries in order to make it work with Npgsql.<br />
<br /></div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com26tag:blogger.com,1999:blog-15237920.post-31896047949799921062014-01-21T18:05:00.000-02:002014-01-21T18:05:53.197-02:00New developer and user discussion groups available!Npgsql has new developers and users communication channels.<br />
<br />
Shay Rojansky created two new discussion groups for Npgsql: <a href="https://groups.google.com/forum/#!forum/npgsql-dev">npgsql-dev</a> and <a href="https://groups.google.com/forum/#!forum/npgsql-help">npgsql-help</a>. Those groups will be used in place of the <a href="http://lists.pgfoundry.org/mailman/listinfo/npgsql-devel">Npgsql-devel mailing list</a> and <a href="http://pgfoundry.org/forum/?group_id=1000140">the forums available on pgfoundry.org</a> respectively.<br />
<br />
Please, feel free to send your questions and comments to those groups. We hope those groups are very helpful to users looking for Npgsql support.<br />
<br />
<br />Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-44176196427242768902013-12-10T09:19:00.001-02:002013-12-22T17:53:28.923-02:00Npgsql 2.0.14 released!<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="color: red;">Update (2013-12-22):</span> 2.0.14.3 was released with a fix for entity framework boolean value handling. See <a href="https://github.com/npgsql/Npgsql/issues/132">this issue</a> and <a href="https://github.com/npgsql/Npgsql/commit/f8a82fadc9e9f5d6c95988020232107f62e83d2d">this commit</a> for more info about this fix.<br />
Package zip files are already available from <a href="http://downloads.npgsql.org/">pgfoundry</a> and <a href="https://github.com/npgsql/Npgsql/releases/tag/v2.0.14.3">github</a>.<br />
<br />
<div style="text-align: center;">
* * *</div>
<br />
After a lot of time since last stable release, Npgsql 2.0.14 is out! This is a small bugfix release with fix for hangs which could happen when connecting to Postgresql 9.3. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This bug appeared when Postgresql sent an error message. Npgsql had a problem handling some error code fields and then hang while processing it. Whooops! :) </div>
<div style="text-align: justify;">
Thanks to Glen Parker, it is <a href="https://github.com/glenebob/Npgsql2/commit/5800eec287fc72ee4d051750b05253aed8deb46e">fixed on github</a>. If you are having hang problems while using Npgsql after upgrade the server to 9.3 version, this version is for you.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3>
2.0.14?</h3>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Those who are paying attention to the version number may have noticed that the version number is 2.0.14 and not 2.0.13 as it should be. After all, we already had a 2.0.13-beta1 <a href="http://fxjr.blogspot.com.br/2013/06/npgsql-2013-beta1-released.html">released</a>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The fact is that after 2.0.13-beta1, we had a lot of changes. From performance tweaks to better Entity Framework support and many other changes that we decided to skip 2.0.13 and call it <b>Npgsql 2.1</b>! Yes, you read it right. After so many years in the 2.0.x versions, we will ship our first 2.1 version. I'll post more info about it in a future post. I hope this version number change doesn't give too much confusion.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can grab Npgsql 2.0.14 from <a href="https://www.nuget.org/packages/Npgsql/">nuget repository</a>. You can install it directly from Visual Studio and Xamarin Studio through Nuget Package Manager.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
We are also packing zip distributions to put on our downloads section. <strike>We are having some problems with our downloads host but as soon as we get them available I'll update this post</strike>. They are already available at <a href="http://downloads.npgsql.org/">pgfoundry</a> and <a href="https://github.com/npgsql/Npgsql/releases/tag/v2.0.14.3">github</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
As always, send your comments and feedback about this release. They are very welcome and will help us to get more goodies in your hands on next releases.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com24tag:blogger.com,1999:blog-15237920.post-15256316680432966652013-07-18T15:57:00.000-03:002013-07-18T18:14:40.891-03:00SSLStream support added to Npgsql!<div style="text-align: justify;">
Yesterday I merged a pull request which <a href="https://github.com/franciscojunior/Npgsql2/pull/27">adds support to .Net SSLStream</a> in Npgsql.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
When Npgsql development started, in 2002, there was no SSL support in .net 1.0 and 1.1. It was added later in .net 2.0 but the support to SSLStream was never added to Npgsql.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This all changed a few weeks ago when <a href="https://github.com/dreamlax">Dave G</a> created <a href="https://github.com/dreamlax/Npgsql2/commit/101585999206218e7c09b7b25e57a6d2d0b789da">a patch</a> which adds support to .Net SSLStream in Npgsql. He also said that one of the motivations was the fact that the current SSL support was returning error when using client certificate authentication. (I'll post a tutorial about how to use client certificates later)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
There is a <a href="http://pgfoundry.org/tracker/index.php?func=detail&aid=1000445&group_id=1000140&atid=593">very old feature request</a> (like since 2005!) to somehow create a single Npgsql.dll which incorporates Mono.Security.dll assembly. This would easy the deployment of Npgsql and version control. This feature request generated a discussion about the removal of Mono.Security dependency and possible impact in current user code. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In order to get the lowest impact by this change, instead of immediately remove the callbacks and break a lot of user code, I asked Dave to keep the callbacks and mark them obsolete. This way, users will be warned about those callbacks instructed to use the <a href="http://msdn.microsoft.com/en-US/library/system.net.security.remotecertificatevalidationcallback(v=vs.80).aspx">SSLStream RemoteCertificateValidationCallback</a> instead.</div>
<br />
<div style="text-align: justify;">
In order to use the new SSL code, you just need to add a callback to ValidateRemoteCertificateCallback.</div>
<div style="text-align: justify;">
It can be as simple as:</div>
<br />
<pre style="background: #fdf6e3; color: #839496; font-family: Consolas; font-size: 13;"><span style="color: #b58900;">NpgsqlConnection</span> <span style="font-weight: bold;">conn</span> <span style="color: #d33682;">=</span> <span style="color: #859900;">new</span> <span style="color: #b58900;">NpgsqlConnection</span>(<span style="font-weight: bold;">CONNSTRING</span>);
<span style="font-weight: bold;">conn</span><span style="color: #d33682;">.</span><span style="font-weight: bold;">ValidateRemoteCertificateCallback</span> <span style="color: #d33682;">+=</span> (<span style="font-weight: bold;">a</span>, <span style="font-weight: bold;">b</span>, <span style="font-weight: bold;">c</span>) <span style="color: #d33682;">=></span> { <span style="color: #859900;">return</span> <span style="color: #859900;">true</span>; };</pre>
<pre style="background: #fdf6e3; color: #839496; font-family: Consolas; font-size: 13;">
</pre>
<br />
<div style="text-align: justify;">
This callback simply returns true indicating you are accepting the server certificate. Obviously, returning true without doing any validation should be done for testing purposes only.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Please, give it a try and let me know if you have any problems. </div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com3tag:blogger.com,1999:blog-15237920.post-40259171940001323292013-07-15T10:16:00.000-03:002013-07-18T18:15:29.670-03:002.0.13-beta1 Nuget packages available!After a long delay, Nuget packages for 2.0.13-beta1 are finally available!<br />
<br />
Since they are beta, you will need to use a command line parameter when installing this package.<br />
<br />
<a href="https://nuget.org/packages/Npgsql">According to Nuget</a>, you will need to use the following command:<br />
<br />
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.59375px;">PM> Install-Package Npgsql -Pre</span><br />
<br />
Please, give it a try and let me know if it works ok.<br />
<br />
This package also <a href="https://github.com/franciscojunior/Npgsql2/pull/24">fixes</a> the <a href="http://pgfoundry.org/tracker/?func=detail&atid=590&aid=1011294&group_id=1000140">problem</a> of police files compiled to .Net 2.0 framework only. This was giving problems when installing Npgsql on .net 4.0 runtimes. Thanks <a href="https://github.com/yfakariya">Yusuke Fujiwara</a> for fixing it.Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com1tag:blogger.com,1999:blog-15237920.post-3670363770033442562013-06-28T15:56:00.002-03:002013-06-28T15:57:47.090-03:00Npgsql 2.0.13 beta1 released!<br />
<div style="text-align: justify;">
<b>Today we released the first beta of Npgsql 2.0.13! </b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This new beta release had a lot of bugs fixed and initial support for Entity Framework 6! More information about how to use Entity framework 6 with Npgsql can be found in <a href="http://fxjr.blogspot.com/2013/06/initial-ef-6-support-added-to-npgsql.html">this post</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Checkout the <a href="http://pgfoundry.org/frs/shownotes.php?release_id=2039">release notes</a> for more information about the bugs fixed in this release.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Download it from our <a href="http://pgfoundry.org/frs/?group_id=1000140&release_id=2039">downloads section</a>.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Important notice about this release</h3>
<div style="text-align: justify;">
<b><br /></b></div>
<div style="text-align: justify;">
Unfortunately, I made a mistake when updating the assembly version for this release and it was created with a wrong value. I'm very sorry for that.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This release should have been 2.0.<span style="color: red;">12</span>.91 and not 2.0.<span style="color: red;">13</span>.91</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Next beta release will have the version value fixed.</div>
<div style="text-align: justify;">
<br /></div>
<h4 style="text-align: justify;">
What are the implications? </h4>
<div style="text-align: justify;">
The biggest problem is that this beta version will have a version number higher than the final 2.0.13 version while this beta version has 2.0.13.91. As it is a beta and it is not supposed to be deployed in production systems, we think this won't give problems to our users. We are very sorry for any problem this may have caused.</div>
<div style="text-align: justify;">
<br /></div>
<h4 style="text-align: justify;">
How is Npgsql assembly versioned?</h4>
<div style="text-align: justify;">
In the beginning, we used to use the same assembly version througout all the beta release cycle until the final release.</div>
<div style="text-align: justify;">
With this approach, Npgsql 2.0.10 beta1 would have the assembly version of 2.0.10.0 and beta2 would also have the assembly version of 2.0.10.0. This was creating confusion between users because they couldn't differentiate which version they were working with.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Starting with 2.0.11, we changed this in order to identify each version. We started to use the last two parts of the assembly version in order to identify beta releases. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This way, a beta release was identified in the following form:</div>
<br />
<ul>
<li style="text-align: justify;">Npgsql 2.0.11 beta1 would be identified as: 2.0.10.91;</li>
<li style="text-align: justify;">Npgsql 2.0.11 beta2 would be identified as 2.0.10.92 and so on. </li>
</ul>
<div style="text-align: justify;">
With this schema, the beta versions will be incremented towards the final version 2.0.11.0. </div>
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Regarding this 2.0.13 beta1 release, its assembly version should have been 2.0.<b>12.91</b> and not 2.0.<b>13.91</b>. The former value indicates the assembly is approaching the 2.0.13 while the latter indicates the assembly is approaching 2.0.14 which is not the case.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
We hope this won't happen again. :(</div>
<div>
<br /></div>
<b><br /></b>
<b><br /></b>Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com7tag:blogger.com,1999:blog-15237920.post-82816992300084861472013-06-27T14:27:00.000-03:002013-06-27T14:27:11.875-03:00Performance improvements when creating NpgsqlConnection objects<div style="text-align: justify;">
Recently, <a href="https://github.com/franciscojunior/Npgsql2/commit/ff0a4b905e5b0f7a9c505b1ca7c7a366673d358b">I applied a patch</a> from <a href="https://github.com/kppullin">Kevin Pullin</a> which will improve the performance of programs using Npgsql. This patch reduces significantly the time to create new NpgsqlConnection objects. This particularly applies in scenarios where you are creating and disposing a lot of NpgsqlConnection objects, like when <a href="http://msdn.microsoft.com/en-us/library/ms971481.aspx">you are using connection pool</a>, ( you are using it, right? :) ).</div>
<h4>
Comparison test</h4>
<div style="text-align: justify;">
I made an artificial test to show the impact of this patch. This test consists of a simple loop where I create 10k NpgsqlConnection objects. </div>
<br />
<pre style="background: #fdf6e3; color: #839496; font-family: Consolas; font-size: 13;"><span style="color: #859900;"> class</span> <span style="color: #b58900;">Program</span>
{
<span style="color: #859900;">static</span> <span style="color: #859900;">void</span> <span style="font-weight: bold;">Main</span>(<span style="color: #859900;">string</span>[] <span style="font-weight: bold;">args</span>)
{
<span style="color: #859900;">var</span> <span style="font-weight: bold;">connString</span> <span style="color: #d33682;">=</span> <span style="color: #2aa198;">"server=127.0.0.1;userid=npgsql_tests;database=npgsql_tests;"</span>;
<span style="color: #b58900;">Stopwatch</span> <span style="font-weight: bold;">sw</span> <span style="color: #d33682;">=</span> <span style="color: #b58900;">Stopwatch</span><span style="color: #d33682;">.</span><span style="font-weight: bold;">StartNew</span>();
<span style="color: #859900;">for</span> (<span style="color: #859900;">int</span> <span style="font-weight: bold;">i</span> <span style="color: #d33682;">=</span> <span style="color: #2aa198;">0</span>; <span style="font-weight: bold;">i</span> <span style="color: #d33682;"><</span> <span style="color: #2aa198;">10000</span>; <span style="font-weight: bold;">i</span><span style="color: #d33682;">++</span>)
{
<span style="color: #859900;">var</span> <span style="font-weight: bold;">conn</span> <span style="color: #d33682;">=</span> <span style="color: #859900;">new</span> <span style="color: #b58900;">NpgsqlConnection</span>(<span style="font-weight: bold;">connString</span>);
}
<span style="font-weight: bold;">sw</span><span style="color: #d33682;">.</span><span style="font-weight: bold;">Stop</span>();
<span style="color: #b58900;">Console</span><span style="color: #d33682;">.</span><span style="font-weight: bold;">WriteLine</span>(<span style="font-weight: bold;">sw</span><span style="color: #d33682;">.</span><span style="font-weight: bold;">ElapsedMilliseconds</span>);
}
}</pre>
<br />
<br />
<h4>
These are the results </h4>
Code without patch:<br />
<br />
<ul>
<li>1st run: 1316 ms</li>
<li>2nd run: 1333 ms</li>
<li>3rd run: 1310 ms</li>
<li><b>Average time: 1319 ms</b></li>
</ul>
<br />
Code with patch:<br />
<br />
<ul>
<li>1st run: 33 ms</li>
<li>2nd run: 39 ms</li>
<li>3rd run: 33 ms</li>
<li><b>Average time: 35 ms</b></li>
</ul>
<br />
<div style="text-align: justify;">
The new code, on this test, was more than 30 times faster! Of course this doesn't mean your code will be 30 times faster, after all your code doesn't consist of only creating NpgsqlConnection objects, but imagine a high traffic server which receives a lot of requests. When you sum up all the time spent creating NpgsqlConnection objects, this performance gain would make a difference.</div>
<span style="text-align: justify;"><br /></span>
<span style="text-align: justify;">Please, give it a try and let me know how it works for you. Just go to </span><a href="http://git.npgsql.org/" style="text-align: justify;">Npgsql git page</a><span style="text-align: justify;"> and press the "Download ZIP" button and get a snapshot of the code. Open the Npgsql2010.sln solution file, build and test! </span><br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Again, thank you very much, Kevin, for your patch!</div>
<br />
<br />Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-71735374394385284752013-06-17T14:11:00.000-03:002013-06-17T14:12:40.086-03:00Initial EF-6 support added to NpgsqlIn my <a href="http://fxjr.blogspot.com/2013/06/npgsql-code-first-entity-framework-431.html">last post</a>, I said there is a pull request by Pēteris Ņikiforovs to add support for EF-6 to Npgsql. Yesterday, <a href="https://github.com/franciscojunior/Npgsql2/commit/63af6457c167d93163a772662f9fe8057d866b08">I merged this pull request to the master branch of Npgsql</a>.<br />
<br />
With this merge, <b>Npgsql has officially initial support for EF-6!</b><br />
<h3>
How to compile</h3>
For now, in order to compile Npgsql to use EF-6, you have to open the solution file NpgsqlEF6.sln. Later, <a href="https://github.com/franciscojunior/Npgsql2/pull/19#issuecomment-17622474">as suggested by Pēteris Ņikiforovs</a>, the idea is that we create a new configuration inside main project solution instead of maintain 2 separated projects.<br />
<br />
Another thing you will need to compile Npgsql is the <a href="https://nuget.org/packages/entityframework">latest release of EntityFramework</a> assembly through NuGet:<br />
<br />
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.59375px;">PM> Install-Package EntityFramework -Pre</span><br />
<br />
That's it! Now you will be able to play with Npgsql and EF-6. Check out my previous post about how to use Npgsql with EntityFramework.<br />
<br />
I'd like to thank Pēteris Ņikiforovs for his patch. And maxbundchen for his patch about Open/Close events needed for EF-6.<br />
<br />
Please, give it a try and let me know how it works for you.Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com44tag:blogger.com,1999:blog-15237920.post-22174867979224820342013-06-08T18:06:00.001-03:002013-06-08T18:06:50.329-03:00Npgsql Code First Entity Framework 4.3.1 Sample<br />
<br />
<div style="text-align: justify;">
After reading the excellent article about <a href="http://brice-lambson.blogspot.com.br/2012/10/entity-framework-on-postgresql.html">entity framework on Postgresql</a> by Brice Lambson, I decided to write this post to document my experience playing with Entity Framework 4.3.1 and Npgsql. This post will be an adaptation of the <a href="http://msdn.microsoft.com/en-us/data/jj193542">Code First To a New Database</a> walkthrough in order to make it work with Npgsql. </div>
<div style="text-align: justify;">
<br /></div>
<h3>
<span style="font-family: Verdana, sans-serif;">First Steps</span></h3>
<div style="text-align: justify;">
You should follow the first 4 steps of Code First To a New Database. Go ahead, I''l wait for you.</div>
<br />
<h3>
<span style="font-family: Verdana, sans-serif;">Next steps</span></h3>
Here is where the adaptation of the walkthrough begins. As Brice noted in his post, Npgsql currently doesn't support database creation. ( I'm working on that and hope to get news about it soon.) So, for while, you have to create the database manually. <br />
<br />
Those are the steps you have to do to create the database and the model:<br />
<div>
<br /></div>
First, run this command in the terminal to create the database (or you can use <a href="http://www.pgadmin.org/">pgAdmin</a> if you prefer a GUI):<br />
<div>
<br />
<div>
<span style="font-family: Courier New, Courier, monospace;"><b>> createdb ef_code_first_sample </b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
After that, you have to run the following commands inside the database you have just created (to simplify permissions, remember to run this script connected as the same user who is specified in your connection string):<br />
<div>
<span style="font-family: Times, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b>create table "Blog" ("BlogId" serial, "Name" varchar(255));</b></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><b>create table "Post" ("PostId" serial, "Title" varchar(255), "Content" varchar(8000), "BlogId" int);</b></span></div>
<div>
<span style="font-family: Times, Times New Roman, serif;"><br /></span></div>
<div style="text-align: justify;">
And here comes the first trick you have to use when working with EF and Npgsql: <b>the table names as well as column names need to be double quoted</b>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Entity Framework generates code with table and column names double quoted and, to Postgresql, using double quotes means you want to preserve the casing of the names. So you need to create the tables with the correct case or else, Postgresql will complain it can't find your tables.</div>
<div style="text-align: justify;">
<br /></div>
<div>
With the database and tables created, let's make some more configuration before we can run the sample.</div>
<div>
<h3>
Entity Framework installation</h3>
<div style="text-align: justify;">
Unfortunately Npgsql doesn't support EF 5. Currently it supports 4.3.1 and <a href="https://github.com/franciscojunior/Npgsql2/pull/19">there is a pull request</a> by Pēteris Ņikiforovs to add support for EF 6. Yeah, Npgsql will have support for latest EF version soon!</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
You will need to install the 4.3.1 version of EF. According to <a href="http://nuget.org/packages/EntityFramework/4.3.1">EF Nuget project page</a>, this is done with the following command:</div>
</div>
<div>
<br /></div>
<div>
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.59375px;">PM> Install-Package EntityFramework -Version 4.3.1</span></div>
<div>
<br />
This is needed because if you don't specify the 4.3.1 version, Nuget will install the latest version which isn't supported by Npgsql yet.</div>
<h3>
Npgsql installation</h3>
<div>
If you don't have Npgsql installed already, you should install Npgsql from Nuget too:</div>
<div>
<br /></div>
<div>
<div>
<span style="background-color: #202020; color: #e2e2e2; font-family: 'andale mono', 'lucida console', monospace; font-size: 20px; line-height: 30.59375px;">PM> Install-Package Npgsql</span></div>
</div>
<div>
<br /></div>
<div>
And then you should configure Npgsql in your App.config to be found by the DbProviderFactory API: </div>
<div>
<br />
<span style="font-family: Courier New, Courier, monospace;"><b><system.data></b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> <DbProviderFactories></b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> <add name="Npgsql Data Provider"</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> invariant="Npgsql"</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> description="Data Provider for PostgreSQL"</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> type="Npgsql.NpgsqlFactory, Npgsql" /></b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> </DbProviderFactories></b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b></system.data></b></span><br />
<br /></div>
</div>
<div>
and configure your connection string in the same App.config file:</div>
<div>
<br />
<span style="font-family: Courier New, Courier, monospace;"><b><connectionStrings></b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> <add name="BloggingContext"</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> providerName="Npgsql"</b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> connectionString="server=10.0.2.2;userid=npgsql_tests;password=npgsql_tests;database=ef_code_first_sample"/></b></span><br />
<span style="font-family: Courier New, Courier, monospace;"><b> </connectionStrings></b></span><br />
<br /></div>
<h3>
Running the code</h3>
<div>
<div style="text-align: justify;">
Now it's time to run the code. If you have everything configured and hit Ctrl+F5 you should get the code running and will be greeted with the Blog name question.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
Unfortunately after answering the question and pressing enter, an exception will be thrown:</div>
</div>
<div>
<br /></div>
<div>
<div style="text-align: left;">
<span style="background-color: white; font-family: Courier New, Courier, monospace;"><b>Unhandled Exception: System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---</b></span></div>
<div style="text-align: left;">
<span style="background-color: white; font-family: Courier New, Courier, monospace;"><b>> System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> Npgsql.NpgsqlException: ERROR: 3F000: schema "dbo" does not exist</b></span></div>
</div>
<div style="text-align: left;">
<br /></div>
<div>
This error occurs because by default, Entity Framework uses the schema dbo and Postgresql uses the schema public. This is the message you get in the Postgresql log:</div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace;"><br /><b>INSERT INTO "dbo"."Blogs"("Name") VALUES (E'test');SELECT currval(pg_get_serial_sequence('"dbo"."Blogs"', 'BlogId')) AS "BlogId"<br /><br />ERROR: schema "dbo" does not exist at character 13</b></span><div>
<br /></div>
<div>
<div style="text-align: justify;">
As pointed out by Brice in <a href="http://brice-lambson.blogspot.com/2012/10/entity-framework-on-postgresql.html?showComment=1354725648474#c3442323245754664359">his answer</a> to a user question about this error, you have to tell Entity Framework to use a different schema. This is done by using Data Annotations and adding a Table attribute to the classes of the model:</div>
</div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace;"><b>[Table("Blog", Schema = "public")]</b></span><div>
<span style="font-family: 'Courier New', Courier, monospace;"><b>public class Blog</b></span><span style="font-family: Courier New, Courier, monospace;"><br /></span><div>
<br /></div>
<div>
and</div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace;"><b>[Table("Post", Schema = "public")]</b></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;"><b>public class Post</b></span><span style="font-family: Courier New, Courier, monospace;"><br /></span><div>
<br /></div>
<div>
To use those attributes, you have to import the Data Annotations namespace:</div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace;"><b>using System.ComponentModel.DataAnnotations;</b></span><div>
<br /></div>
<div>
<div style="text-align: justify;">
More information about that can be found in the Code First To a New Database article linked at the beginning of this post.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
That's it! After making those changes, you should now get the data correctly inserted in the database and everything should work ok:</div>
</div>
<div>
<br /></div>
<span style="font-family: Courier New, Courier, monospace;"><b>LOG: statement: INSERT INTO "public"."Blog"("Name") VALUES (E'test');SELECT currval(pg_get_serial_sequence('"public"."Blog"', 'BlogId')) AS "BlogId"</b></span><div>
<br /></div>
<div>
<br />
<div style="text-align: justify;">
I hope you enjoyed this post and could get started to Entity Framework and Npgsql. Please, let me know what you think in your comments. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I'd like to thank Brice Lambson for his excellent article and the Microsoft Entity Framework team for their Code First To a New Database walkthrough and all the EF stuff.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
</div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com14tag:blogger.com,1999:blog-15237920.post-90202576771500572292013-05-02T23:22:00.000-03:002013-05-02T23:22:33.220-03:00Npgsql code moved to GitHub!<br />
<div align="JUSTIFY" lang="en-US" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" lang="en-US" style="margin-bottom: 0cm;">
<br /></div>
<div align="JUSTIFY" lang="en-US" style="margin-bottom: 0cm;">
Since the
beginning, in 2002, Npgsql has been using cvs as its source code
management system (SCM). At the time, cvs was being used by a lot of
opensource projects, and so it was a natural choice for Npgsql.</div>
<div align="JUSTIFY" lang="en-US" style="margin-bottom: 0cm;">
<br />
A couple of days ago, Npgsql code moved to GitHub. I didn't blog about that in the same day because I wanted to make sure things went well before spreading the word. :) ( You may be asking yourself: But Npgsql code was already at GitHub, wasn't it? Yes, it was. But it was only a mirror of the main cvs repository. And I had to update the code manually every time. Every change had to go first to the main repository cvs and then I would update in GitHub. Obviously the code was often outdated. This is a thing of the past now.) <br />
<br />
Git was chosen mainly because there is a lot of documentation about it, it is powerful and because of GitHub. GitHub provides many resources which will help us have a much better environment for our collaborators and users.<br />
<br />
For our collaborators there is the idea of cloned repositories and the ability to give us a much better feedback based on pull requests. We will be able to much easily apply changes from our collaborators based on those pull requests. Besides that, our collaborators will be able to use all the power of git to get a better workflow when playing with Npgsql code.<br />
<br />
Users will also get a lot of benefits. GitHub provides links to download code from each branch. This will allow users who want to test an unreleased version of Npgsql to try out new features without having to either install git or wait for us to create a beta version.<br />
<br />
I'm very confident this change will bring a lot of benefits to Npgsql community. I hope you enjoy this change as much as I do.<br />
<br />
I'd like to thank a person who contributed a lot to make this happen. I'm sure that, without his help, this migration would have taken a lot more time: <a href="https://github.com/roji">Shay Rojansky</a>. Shay has been helping me since the beginning and gave me all the support I needed to get Npgsql code into GitHub. Thank you very much, Shay!<br />
<br />
Also, I'd like to thank the persons behind the excellent script <a href="http://cvs2svn.tigris.org/cvs2git.html">cvs2git</a>. This script did all the hard work of converting the code from cvs to git. Thank you guys!<br />
<br />
And last but not the least, I'd like to thank people from pgfoundry where Npgsql had its code hosted until now. Thank you for all the fish.<br />
<br />
Npgsql can be found on GitHub at the following addresses:<br />
<br />
<a href="http://git.npgsql.org/">http://git.npgsql.org</a><br />
or<br />
<a href="https://github.com/franciscojunior/Npgsql2">https://github.com/franciscojunior/Npgsql2</a><br />
<br />
<br />
Please, give it a try and let me know if you find any problems.<br />
<div>
<br /></div>
<br />
<br />
<br /></div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com0tag:blogger.com,1999:blog-15237920.post-90073605488344025622012-11-20T14:17:00.000-02:002012-11-20T14:17:01.154-02:00Better tracing of Npgsql connection pool usage in the works<br />
<br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Sometimes, Npgsql users receive errors when working with connection pooling. The problem appears when they try to open a new connection and receive the following message:</span> </div>
<br />
<span style="background-color: #f3f3f3; font-family: Courier New, Courier, monospace;">"Timeout while getting a connection from pool."</span><br />
<br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">This is caused when an attempt is made to get a connection from a pool which has all its connections used. Most of the time this problem is a difficult one to track because it generally happens when the system is in production and not in the development phase. Of course. :)</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Some time ago, I received a report from Miłosz Kubański about such a problem. I told him I would work in a way to get more information so we could check what was happening.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">In order to help us find the problem, I added a little </span><span style="font-family: Verdana, sans-serif;">"hack" to </span><span style="font-family: Verdana, sans-serif;">Npgsql: Whenever an error while getting a connection from the pool occurs, Npgsql would log a stacktrace of the allocation of all the connections which were in the pool. Theoretically, those connections which were allocated should not be retained and by taking a "snapshot" of those allocations, we could get some tips about </span><span style="background-color: white; font-family: Verdana, sans-serif;">which code</span><span style="font-family: Verdana, sans-serif;"> allocated the connection and check for potential missing releases.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Last week I sent Milosz this modified version of Npgsql so he could give it a try and send me back the log. Yesterday he sent me the log. Inside it, I chose two stacktraces and asked him if would be possible there was any missing close.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Milosz replied saying there was indeed a missing close call. It was an exception inside a very complex system. </span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Based on this feedback, I think this "hack" has shown to be very useful in future cases and I'll work to get this change in a "non-hack" status and add it to Npgsql code. I hope this helps Npgsql users to find possible causes for connection pooling problems.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">When this feature is available I'll let you know.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<br /></div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com7tag:blogger.com,1999:blog-15237920.post-46076756603566148682012-10-10T12:34:00.001-03:002012-10-10T12:34:59.041-03:00Where is vs.net design time support?<br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">You may already know that VS.Net design time support has started <a href="http://fxjr.blogspot.com/2011/05/npgsql-design-time-support-preview.html">a long time ago</a> and didn't have too much support since then. </span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Now that Npgsql <a href="http://pgfoundry.org/frs/?group_id=1000140">release 2.0.12</a> is out, I want to put more attention to finish a version which adds design time support. I noticed that this is the biggest missing feature in Npgsql and I want to fix that. Npgsql users deserve to be able to use VS.Net design time support to help them create better apps which access Postgresql databases.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Although I can't give any concrete timeframe of when it will be available, I want you to know that I'm focused on this feature and it is not stalled. I hope to be able to give you more information soon.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Stay tuned.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<br /></div>
Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com4tag:blogger.com,1999:blog-15237920.post-56941991083454669302012-01-09T13:13:00.002-02:002012-01-09T13:13:39.112-02:00ConnectionPool performance improvements<br />
<div class="p1">
<br /></div>
<div class="p2">
Hi, all!</div>
<div class="p1">
<br /></div>
<div class="p2">
Today <a href="http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/npgsql/Npgsql2/src/Npgsql/NpgsqlConnectorPool.cs?rev=1.20&content-type=text/x-cvsweb-markup">I committed a change</a> to Npgsql which will improve connection pool performance. This change was motivated by <a href="http://pgfoundry.org/tracker/index.php?func=detail&aid=1011138&group_id=1000140&atid=590">Andrew's bug report</a> where he noticed that a lot of threads were waiting to get a new connection from pool.</div>
<div class="p1">
<br /></div>
<div class="p2">
In order to keep consistence of the pool, Npgsql has to lock access to it. Andrew's problem appeared in a busy server where a lot of threads were trying to get a new connection from the pool. They had to wait in line. And obviously this isn't good.</div>
<div class="p1">
<br /></div>
<div class="p2">
The current implementation of Npgsql creates a big lock surrounding all the code needed to work with the pool and more! As Andrew noticed in his bug report, <b>I/O operations were being done inside this lock</b> which was contributing to more delays to get a connection from the pool.</div>
<div class="p1">
<br /></div>
<div class="p2">
So, to fix that, I rewrote connection pool logic <b>to remove this big lock and break it down to smaller ones</b> only when really needed. All the <b>I/O operations were left out of the locks</b>, this way, other threads waiting to get a new connection from the pool don't need to wait for those expensive operations to finish.</div>
<div class="p1">
<br /></div>
<div class="p2">
I made a lot of tests and could confirm that when I break the code inside the debugger, threads are spread throughout connection pool code as expected instead of waiting in line on the big lock.</div>
<div class="p1">
<br /></div>
<div class="p2">
As this change is somewhat critical to Npgsql usage, I'd like to ask you to download the code, compile it and give it a try and see if everything is working ok or even better than before. I expect busy servers to be able to increase their raw throughput because it will have to wait less to get connections from the pool.</div>
<div class="p1">
<br /></div>
<div class="p2">
As always, please, let me know if you have any problems and all feedback is very welcome!</div>
<div class="p1">
<br /></div>Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com4tag:blogger.com,1999:blog-15237920.post-48176343168012355932011-12-14T14:50:00.000-02:002011-12-14T14:50:49.404-02:00Npgsql2 source code mirror is now available on github<br />
Hello, all!<br />
<br />
Npgsql2 source code hosted on <a href="http://cvs.npgsql.org/Npgsql2">pgfoundry</a> is now mirrored on github: <a href="https://github.com/franciscojunior/Npgsql2">https://github.com/franciscojunior/Npgsql2</a><br />
<br />
What does this mean to developers and users?<br />
<br />
<ul>
<li>You have another way of access to latest Npgsql2 code through github interface</li>
<li>I hope it will be easier to developers and users to provide patches. You can make forks and pull requests.</li>
</ul>
<div>
Please, if you weren't being able to access Npgsql2 source code because of cvs, please give it a try on this new interface and let me know if you have any problems.</div>
<div>
<br /></div>
<div>
Thanks github for providing this service to open source community. </div>Francisco Juniorhttp://www.blogger.com/profile/06807288057155551345noreply@blogger.com2Brazil-14.235004 -51.92528-40.023103500000005 -92.3549675 11.553095500000001 -11.4955925