cancel
Showing results for 
Search instead for 
Did you mean: 

.Net Connector - Visual Studio - Support for saving SQL as script file

Adventurer

.Net Connector - Visual Studio - Support for saving SQL as script file

Hi,

 

We have a requirement to integrate PostgreSQL database development using Visual Studio. So, I have installed the EDBDdexProvider that comes along with 'EnterpriseDB Advanced Server' installation. With this provider I am able to connect to Postgres server via 'Server Explorer' of Visual Studio and execute a query.

 

However I want to save the PostgreSQL query/script regarding maintaining the all the SQL objects tables, stored procedures, views etc. in the form of scripts. This is similar to what we can achieve with a SQL server database project. Is there any such provision with 'EDB Postgres .Net Connector'?

3 REPLIES
Moderator

Re: .Net Connector - Visual Studio - Support for saving SQL as script file

Hi, 

 

Can you please clarify the requirements a bit more in detail? If you want to execute SQL files directly, then you use the psql application directly with an input file using -f filename (https://www.postgresql.org/docs/devel/static/app-psql.html).

 

If the requirement is to call the scripts from within a .Net appliocation, you can go ahead create a connection and then call the script files. For creating connections you can folllow the steps mendtioned on the following link::

https://www.enterprisedb.com/docs/en/9.6/dotnet/EDB_Postgres_Advanced_Server_NET_Connector_Guide.1.1...

 If the query was different, please share the same with an example and we can try our best to help you out.

 

Amit

Adventurer

Re: .Net Connector - Visual Studio - Support for saving SQL as script file

What I need is a text/language editor for Postgres in Visual Studio that has the abilities 'Intelligent Code Completion' and save the script as a .sql/psql within Visual Studio.

 

With the existing 'EDB Postgres Advanced Server .Net Connector' I can open a text/language editor for Postgres, however there is no 'Intelligent Code Completion' in it. Without this feature it is almost same as a notepad application as I can't find compile time errors until I execute the script.

 

The existing text/language editor does not allow the PostgreSQL script as a file. So, I should copy the entire script developed in this editor to another file and save it manually. Both of these missing options make development harder.

 

Please let me know if you have any doubts/clarifications.

Highlighted
Moderator

Re: .Net Connector - Visual Studio - Support for saving SQL as script file

This might just not be possible right out of the box. You can try two ways to get the desired results::

 

1. Use an open source tool like PGAdmin 

2. Or you can try Visual Studio plugins like NPGSQL (https://marketplace.visualstudio.com/items?itemName=RojanskyS.NpgsqlPostgreSQLIntegration)

Amit