Map a function that returns refcursor and OUT parameter
Posted: Tue 06 Mar 2018 09:22
Hello,
I am using Devart.Data.PostgreSql, DataContexts and function mapping style to call and execute functions against pgsql database.
Currently, this is similar working scenario:
which is fine, but I'd like to add OUT parameter, which currently I can only achieve when function "get_users" returns "records", but then the mapping breaks?
Any ideas?
I am using Devart.Data.PostgreSql, DataContexts and function mapping style to call and execute functions against pgsql database.
Currently, this is similar working scenario:
Code: Select all
[Function(Name = "get_users")]
[ResultType(typeof(User), 1)]
[ResultType(typeof(UserRole), 2)]
public IMultipleResults GetUsers([Parameter(Name = "p_id", DbType = "int4")] Nullable<int> p_id)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), p_id);
return (IMultipleResults)result.ReturnValue;
}
// then, just reading the cursors like:
var data = ctx.GetUsers(42);
var users = data.GetResult<User>().ToList();
var userRoles = data.GetResult<UserRole>().ToList();
Any ideas?