This is a library open source for execute queries in postgresql database. Package: https://www.nuget.org/packages/ExecuteQuery/
First execute the some procedures, is essential create a ConnectionString in appsettings with name DB or create a environment variable with name "DB".
{
"ConnectionStrings": {
"DB": "{connectionString}"
}
}
For execute this library is essential create query with or whithout brackets, an example:
select
[rowExample].[columnExample] as [columnNameForMapping]
[rowExample].[columnExample]
from [schem].[table] [rowExample]
With the query created, in next level of execution, our let's go create model of return query.
class Model {
public int [namePropertie] { get; set; }
public int [namePropertie] { get; set; }
}
Now let's create a instance of object ExecuteQueryNpgsqlUtil:
using ExecuteQuery.Npgsql;
const instanceObject = new ExecuteQueryNpgsqlUtil();
var resultQuery = await instanceObject.ExecuteQuery<Model>([queryCreated]);
By: Adrian Devid Menezes Santos.
Site of creator: adrian devid menezes santos