Check this article, https://www.c-sharpcorner.com/UploadFile/john_charles/using-postgresql-from-microsoft-net/