Hi,
It seems that it is not possible to import functions with Out or InOut parameters.
Those functions do not appear in the drop down list of the "Add Function Import" dialog.
Does anyone knows why?
Thanks
Import function with Out/InOut parameters
Re: Import function with Out/InOut parameters
We recommend using Entity Developer (the Devart Entity Model template, *.edml) which is adjusted for working with PostgreSQL.
Tips:
1. After adding the function to the *.edml model, select it in Tools > Entity Developer > Model Explorer (the Store part), press F4 and set its Concealed Function property to True (in this case Entity Framework considers this function will be treated as a stored procedure which does not return a value). After this, you can add the method to the conceptual part of the model.
2. Be aware that ref cursor in PostgreSQL can be returned only within opened transaction. An example for ObjectContext:
Tips:
1. After adding the function to the *.edml model, select it in Tools > Entity Developer > Model Explorer (the Store part), press F4 and set its Concealed Function property to True (in this case Entity Framework considers this function will be treated as a stored procedure which does not return a value). After this, you can add the method to the conceptual part of the model.
2. Be aware that ref cursor in PostgreSQL can be returned only within opened transaction. An example for ObjectContext:
Code: Select all
using (MyEntities context = new MyEntities()) {
var connection = (context.Connection as System.Data.EntityClient.EntityConnection).StoreConnection;
connection.Open();
var transaction = connection.BeginTransaction();
result = context.MyMethod();
...
}
Re: Import function with Out/InOut parameters
I've tried that but the resulting CSDL contains a DevArt namespace xmlns:ed="http://devart.com/schemas/EntityDeveloper/1.0" that is used in the <FunctionImport>.
We need to share a same CSDL for 4 databases engines (MSSQL, MySQL, Oracle, PostgreSQL) and because we do not use DevArt for MSSQL I'm not sure thie will work.
We need to share a same CSDL for 4 databases engines (MSSQL, MySQL, Oracle, PostgreSQL) and because we do not use DevArt for MSSQL I'm not sure thie will work.
Re: Import function with Out/InOut parameters
You can do that.Tetranos wrote:We need to share a same CSDL for 4 databases engines (MSSQL, MySQL, Oracle, PostgreSQL)
You can use the CSDL, which is created for SQL Server, for all databases.Tetranos wrote:I've tried that but the resulting CSDL contains a DevArt namespace xmlns:ed="http://devart.com/schemas/EntityDeveloper/1.0" that is used in the <FunctionImport>.
An example of such approach is available at http://www.devart.com/dotconnect/efquerysamples.html. Also please take into account that Oracle/MySQL/PostgreSQL have limitations/differences in behaviour comparing to SQL Server. Some of them are listed here: http://www.infoq.com/articles/multiple-databases.