I wrote code to call a function from PostgreSQL. In the pgAdmin, I call the function and it works fine.
This is my code in C#:
_db.Database.SqlQuery<CreateOrderInfo>($"select * from Asset_CreateOrderInfo('{request.Data!.UserId}',{request.Data!.SymbolId})")
The generated command is like this:
select * from Asset_CreateOrderInfo('00000001-0000-0000-0000-000000000000',2)
When I run the above code in the pgAdmin, it works right. But when I send through the EF Core and C#, It doesn't work and raises this error:
Npgsql.PostgresException (0x80004005): 22P02: invalid input syntax for type uuid: "@p0"
Could you help me understand what the problem is?
Finally, I found the solution myself. I removed the single quote around the '{request.Data!.UserId}' and it worked fine.
It was really a ridiculous problem!!!