Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support for ObjectContext.ExecuteFunction #129

Closed
wants to merge 97 commits into from

Conversation

kenjiuno
Copy link
Contributor

It will allow you to call PostgreSQL's functions and stored procedures via EntityFramework support.

This is for 2.1 branch. And older PR #100 is replaced by this fix.

@roji roji mentioned this pull request Dec 16, 2013
@franciscojunior
Copy link
Member

Adding reference to pgfoundry bug request: http://pgfoundry.org/tracker/?func=detail&atid=590&aid=1011343&group_id=1000140

@roji
Copy link
Member

roji commented Jan 2, 2014

Hi @kenjiuno, thanks for all the great work on EF support.

Is there any chance we can get some unit tests together on EF, like for this PR? To make EF support stable we really need a good suite of regression tests...

@kenjiuno
Copy link
Contributor Author

kenjiuno commented Jan 2, 2014

Hi, thanks for reply!

Yes, I'm willing to write the tests for it!

I'll wait for jjchiw's pull request #116. It contains good test for entity framework.

I'll append my tests after its merge.

@kenjiuno
Copy link
Contributor Author

Hi @roji

Is there any chance we can get some unit tests together on EF, like for this PR? To make EF support stable we really need a good suite of regression tests...

Thanks, I have added 2 tests.

  • GenerateObjectContext
  • ExecuteFunction

Because ObjectContext uses DBFirst model, I have added csdl/msl/ssdl files.

csdl/msl/ssdl files are generated by EdmGen06 against generated npgsql_tests_ef db. And then I have tweaked them manually.

My PostgreSQL is 9.3.1 x64 Windows 8.1. EntityFrameworkBasicTests will succeed on normal PostgreSQL instance (with no additional preparation).

franciscojunior and others added 24 commits July 21, 2014 18:16
(cherry picked from commit bee2709)

(From npgsql#294)
CommandBuilder wasn't properly registering to its DataAdapter
events, resulting in bug npgsql#179

(cherry picked from commit 9940744)

(From npgsql#294)
Note that this only happens in explicit Dispose()/
using, and not when Dispose() is called from a
finalizer (implementation for that is complicated).

Regardless, all prepared statements are automatically
deallocated when a connection is returned to the
connection pool (DISCARD ALL).

Fixes npgsql#158
When a prepared command is re-prepared, the first
backend statement was not deallocated.

Noticed by @franciscojunior
(cherry picked from commit b1a0378)

Backport npgsql#307 from master
This is about as simple as I can make it.

(cherry picked from commit 0d13218)

Backport npgsql#307 from master
Properly handle escaped single quote character ('') in a quoted section during query parameter substitution.

(cherry picked from commit 253b6f9)

Backport npgsql#307 from master
Use close approximations to the repro queries supplied for these bugs, in addition to the simple one devised for diagnosis.

(cherry picked from commit d45f620)

Backport npgsql#307 from master
(cherry picked from commit 5ec17bb)

Backport npgsql#307 from master
… VALUES.

(cherry picked from commit e6c6bf6)

Backport npgsql#310 from master
Used to say 7.x, changed to "9.x and above officially supported"
…n a query that is not allowed, quit immediately. Also improve readability.
roji added 2 commits March 2, 2015 05:35
NpgsqlCommand was listening to its connection's StateChange event so as
to know when the latter was closed, in order to clear its prepared status.
However, it seems that Entity Framework does not dispose of commands, which
led to a leak (since commands never get unsubscribed from their connections).

Rewrote the mechanism without events: a connection maintains a counter that
gets incremented on each open, and the command knows for which counter (i.e.
connection instance) it was prepared.

Backport of 31bdcce

Fixes npgsql#505
@roji roji modified the milestone: 2.2.5 Mar 2, 2015
roji and others added 16 commits March 2, 2015 06:13
Leak removal: Set BaseStream to null when closing connections.
EntityFramework needs a "maintenance" DB in order to create databases,
etc. Previously this was "postgres", but that is available only starting
from PostgreSQL version 8.1. Redshift is based off 8.0 and so EF broke
on it.

Changed to use "template1" instead, which exists on all PostgreSQL versions.

Fixes npgsql#511

(cherry picked from commit 721d5b5)
* Unify test setup to single multi-query SQL, faster test startup
* Unit tests now initialize properly on Redshift (different PK creation,
  don't create unsupported data types). Many unit tests will still break
  on Redshift, need to flag them for ignore.
NpgsqlConnection.GetSchema() used to open a new temporary connection,
modified to reuse the existing connection.

Fixes npgsql#543

(cherry picked from commit 68926d8)

Conflicts:
	tests/ConnectionTests.cs
The GSS and SSPI authentication needs the kerberos service name of the
PostgreSQL server. The default value is POSTGRES but this value can be
changed. The ODBC driver allows to set this value using the
configuration option "krbsrvname". This patch allows to send this
parameter in the connection string.

If the ip address is used instead of the hostname, the SSPI
authentication process uses NTLM authentication. By using the host name
it tries first to use Kerberos and if this is not possible NTLM is used.
The GSS and SSPI authentication needs the kerberos service name of the
PostgreSQL server. The default value is POSTGRES but this value can be
changed. The ODBC driver allows to set this value using the
configuration option "krbsrvname". This patch allows to send this
parameter in the connection string.

If the ip address is used instead of the hostname, the SSPI
authentication process uses NTLM authentication. By using the host name
it tries first to use Kerberos and if this is not possible NTLM is used.
Added values for ConnectionProperty_Description_Krbsrvname and
ConnectionProperty_Display_Krbsrvname to the resource file
Added krbsrvname parameter and use hostname for SSPI authentication to 2.2
Fix NullReferenceException when disposing transactions (race conditon (?))
@roji roji force-pushed the master branch 2 times, most recently from 1236d1f to e8ae2e0 Compare April 12, 2015 07:50
@kenjiuno
Copy link
Contributor Author

Sorry, my branch is broken now. I'll setup new pr against 2.2

@kenjiuno kenjiuno closed this Apr 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants