I\'m trying to return a custom (composite) type based on an implicit table type.
I have this table definition:
CREATE TABLE app_user (id CHAR(36) PRI
Looks like I figured it out. Turned out to be easier than I thought. All I needed to change was the way the stored procedure was called from C#.
ApplicationUser user;
using (NpgsqlConnection db = new NpgsqlConnection(this.connectionString))
{
db.Open();
using (NpgsqlCommand cmd = new NpgsqlCommand("SELECT find_by_id(@user_id);", db))
{
cmd.Parameters.AddWithValue("user_id", userId);
object result = cmd.ExecuteScalar();
user = result == DBNull.Value ? null : (ApplicationUser)result;
}
}
I preferred the other way of invoking the stored procedure, but at least this works!