Skip to content

Commit

Permalink
Merge pull request #5633 from EnterpriseDB/docs/edits_to_netconnector…
Browse files Browse the repository at this point in the history
…_pr5592

Edits to .Net Connector PR5592
  • Loading branch information
nidhibhammar authored May 17, 2024
2 parents dab77b9 + f89bb2e commit 3621653
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 45 deletions.
4 changes: 2 additions & 2 deletions product_docs/docs/net_connector/8.0.2.1/01_release_notes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ New features, enhancements, bug fixes, and other changes in the EDB .NET Connect
| Type | Description |
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Upstream merge | Merged with community .NET driver version 8.0.2. See [release notes](https://www.npgsql.org/doc/release-notes/8.0.html) for more information about merge updates. |
| Security fix | Fixed an security issue [CVE-2024-32655](https://github.com/advisories/GHSA-x9vc-6hfv-hg8c). This security fix, fixes the Npgsql that was vulnerable to SQL injection via protocol message size overflow. |
| Security fix | Fixed a security issue [CVE-2024-32655](https://github.com/advisories/GHSA-x9vc-6hfv-hg8c). This security fix fixes the Npgsql that was vulnerable to SQL injection via protocol message size overflow. |
| Bug fix | Fixed an issue for SPL CALLS. SPL CALLs with output parameters are now returning DataReader with a row of parameters on the batch commands. |
| Bug fix | EnableErrorBarriers is now functional on the batch commands. See [EnableErrorBarries docs](https://www.npgsql.org/doc/api/Npgsql.NpgsqlBatchCommand.html#Npgsql_NpgsqlBatchCommand_AppendErrorBarrier) for more information. |
| Bug fix | EnableErrorBarriers is now functional on the batch commands. See the [EnableErrorBarriers documentation](https://www.npgsql.org/doc/api/Npgsql.NpgsqlBatchCommand.html#Npgsql_NpgsqlBatchCommand_AppendErrorBarrier) for more information. |
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The .NET class hierarchy contains classes that you can use to create objects tha

`EDBCommand`

An `EDBCommand` object contains an SQL command that the client executes against EDB Postgres Advanced Server. Before you can execute an `EDBCommand` object, you must link it to an `EDBConnection` object.
An `EDBCommand` object contains a SQL command that the client executes against EDB Postgres Advanced Server. Before you can execute an `EDBCommand` object, you must link it to an `EDBConnection` object.

`EDBDataReader`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,48 @@ title: "Installing and configuring the .NET Connector"

## Installing the .NET Connector

EDB .NET Connector can be installed using either EDB installer or from NuGet.org. The following sections describe these methods in detail.
You can install the EDB .NET Connector using either the EDB installer or the installer from NuGet.org.

### Installing and configuring the .NET Connector from NuGet.org

#### Install NuGet package via command line

Launch a terminal from your solution folder and run :
Launch a terminal from your solution folder and run:

```text
dotnet add package EnterpriseDB.EDBClient
```

This command will download and install the EDB .NET Connector matching your .NET version. Your project is now ready to import the EDB .NET Connector namespace :
This command downloads and installs the EDB .NET Connector matching your .NET version. Your project is then ready to import the EDB .NET Connector namespace:

```text
using EnterpriseDB.EDBClient;
```

All EDB .NET Connector satellite packages can be found on [NuGet.org](https://www.nuget.org/profiles/EnterpriseDB)
You can find all the EDB .NET Connector satellite packages at [NuGet.org](https://www.nuget.org/profiles/EnterpriseDB).

More information can be found our our [EDB .NET Connector Now Published on NuGet](https://www.enterprisedb.com/blog/improving-developer-experience-updated-edb-net-connector-now-published-nuget) blog post.
For more information, see the [EDB .NET Connector Now Published on NuGet](https://www.enterprisedb.com/blog/improving-developer-experience-updated-edb-net-connector-now-published-nuget) blog post.

#### Install NuGet package via Visual Studio interface

- Right-click your project or solution and choose "Manage NuGet packages"
- Search the package using "enterprisedb.edbclient" as search text
- Choose the "EnterpriseDB.EDBClient" package
- Click "Install" to proceed to package download and installation
1. Right-click your project or solution and select **Manage NuGet package**.
1. Search the package using `enterprisedb.edbclient` as the search text.
1. Select the EnterpriseDB.EDBClient package.
1. Select **Install** to proceed to package download and installation.

This command will download and install the EDB .NET Connector matching your .NET version. Your project is now ready to import the EDB .NET Connector namespace :
This command downloads and installs the EDB .NET Connector matching your .NET version. Your project is then ready to import the EDB .NET Connector namespace:

```text
using EnterpriseDB.EDBClient;
```

More information can be found our our [EDB .NET Connector Now Published on NuGet](https://www.enterprisedb.com/blog/improving-developer-experience-updated-edb-net-connector-now-published-nuget) blog post.
For more information, see the [EDB .NET Connector Now Published on NuGet](https://www.enterprisedb.com/blog/improving-developer-experience-updated-edb-net-connector-now-published-nuget) blog post.

### Installing the .NET Connector using EDB installer

You can use the EDB .NET Connector Installer (available [from the EDB website](https://www.enterprisedb.com/software-downloads-postgres)) to add the .NET Connector to your system.
You can use the EDB .NET Connector installer to add the .NET Connector to your system. The installer is available from [the EDB website](https://www.enterprisedb.com/software-downloads-postgres).

1. After downloading the installer, right-click the installer icon, and select **Run As Administrator** from the context menu. When prompted, select an installation language and select **OK** to continue to the Setup window.
1. After downloading the installer, right-click the installer icon, and select **Run As Administrator**. When prompted, select an installation language and select **OK** to continue to the Setup window.

![The .NET Connector Installation wizard](images/dotnet_installation_wizard.png)

Expand All @@ -66,7 +66,7 @@ You can use the EDB .NET Connector Installer (available [from the EDB website](h

1. When the wizard informs you that it has completed the setup, select **Finish**.

You can also use StackBuilder Plus to add or update the connector on an existing Advanced Server installation.
You can also use StackBuilder Plus to add or update the connector on an existing EDB Postgres Advanced Server installation.

1. To open StackBuilder Plus, from the Windows **Apps** menu, select **StackBuilder Plus**.

Expand Down Expand Up @@ -101,13 +101,13 @@ For information about configuring the .NET Connector in each environment, see:

To reference library files with Microsoft Visual Studio:

1. Select the project in the Solution Explorer.
1. In the Solution Explorer, select the project.
2. Select **Project > Add Reference**.
3. In the Add Reference` dialog box, browse to select the appropriate library files.
3. In the Add Reference dialog box, browse to select the appropriate library files.

Optionally, you can copy the library files to the specified location.

Before you can use an EDB .NET class, you must import the namespace into your program. Importing a namespace makes the compiler aware of the classes available within the namespace. The namespace is `EnterpriseDB.EDBClient`.
Before you can use an EDB .NET class, you must import the namespace into your program. Importing a namespace makes the compiler aware of the classes available in the namespace. The namespace is `EnterpriseDB.EDBClient`.

The method you use to include the namespace varies by the type of application you're writing. For example, the following command imports a namespace into an `ASP.NET` page:

Expand Down Expand Up @@ -177,7 +177,7 @@ You must add the following dependency to your project. You may also need to add

- `EnterpriseDB.EDBClient.dll`

Depending on your application type, you might need to import the namespace into the source code. See Referencing the library files for this and the other information about referencing the library files.
Depending on your application type, you might need to import the namespace into the source code. See [Referencing the library files](#referencing_the_library_files) for this and the other information about referencing the library files.

##### .NET Framework 4.8

Expand All @@ -189,7 +189,7 @@ You must add the following dependency to your project. You may also need to add

- `EnterpriseDB.EDBClient.dll`

Depending on your application type, you might need to import the namespace into the source code. See Referencing the library files for this and the other information about referencing the library files.
Depending on your application type, you might need to import the namespace into the source code. See [Referencing the library files](#referencing_the_library_files) for this and the other information about referencing the library files.

##### .NET Framework 4.8.1

Expand All @@ -201,7 +201,7 @@ You must add the following dependency to your project. You may also need to add

- `EnterpriseDB.EDBClient.dll`

Depending on your application type, you might need to import the namespace into the source code. See Referencing the library files for this and the other information about referencing the library files.
Depending on your application type, you might need to import the namespace into the source code. See [Referencing the library files](#referencing_the_library_files) for this and the other information about referencing the library files.

<div id="standard_setup_2_0" class="registered_link"></div>

Expand Down Expand Up @@ -249,10 +249,9 @@ Depending on your application type, you might need to import the namespace into

##### .NET Entity Framework Core

To configure the .NET Connector for use with Entity Framework Core, the data provider installation path is either:
To configure the .NET Connector for use with Entity Framework Core, the data provider installation path is:

`C:\Program Files\edb\dotnet\EF.Core\EFCore.PG\net8.0`

The following shared library file is required:

- `EnterpriseDB.EDBClient.EntityFrameworkCore.PostgreSQL.dll`
Expand Down Expand Up @@ -310,7 +309,7 @@ dotnet ef dbcontext scaffold Host=<HOST>;Database=<DATABASE>;Username=<USER>;Pas

Add code for defining a DbContext and create, read, update, and delete operations.

For further details, see the Microsoft documentation.
For more details, see the Microsoft documentation.

Issue the following commands to create the initial database and tables:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: "Using the .NET Connector"

<div id="using_the_net_connector" class="registered_link"></div>

These examples show how you can use the EDB object classes that are provided by the EDB .NET Connector that allow a .NET application to connect to and interact with an EDB Postgres Advanced Server database.
These examples show how you can use the EDB object classes that are provided by the EDB .NET Connector. These object classes allow a .NET application to connect to and interact with an EDB Postgres Advanced Server database.

To use these examples, place the .NET library files in the same directory as the compiled form of your application. All of these examples are written in C#, and each is embedded in an ASP.NET page. The same logic and code applies to other .NET applications (WinForm or console applications, for example).

Expand All @@ -21,4 +21,4 @@ Create and save the following `web.config` file in the same directory as the sam
</configuration>
```

An EDB Postgres Advanced Server connection string for an ASP.NET web application is stored in the `web.config` file. If you're writing an application that doesn't use ASP.NET, provide the connection information in an application configuration file such as `app.config`.
An EDB Postgres Advanced Server connection string for an ASP.NET web application is stored in the `web.config` file. If you're writing an application that doesn't use ASP.NET, provide the connection information in an application configuration file, such as `app.config`.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can open a connection using one of the following approaches. In either case,

1. Create an instance of the `EDBDataSource` object using a connection string as a parameter to the create method of the `EDBDataSource` class.

2. Call the `OpenConnection` method of the `EDBDataSource` object to open a connection.
2. To open a connection, call the `OpenConnection` method of the `EDBDataSource` object.

This example shows how to open a connection using a data source:

Expand All @@ -38,7 +38,7 @@ This example shows how to open a connection without a data source:
```

!!! Note
For `EnterpriseDB.EDBClient 7.0.4` and later, we recommend `EDBDataSource` to connect to EDB Postgres Advanced Server database or execute SQL directly against it. For more information on data source, see the [Npgsql documentation](https://www.npgsql.org/doc/basic-usage.html).
For `EnterpriseDB.EDBClient 7.0.4` and later, we recommend `EDBDataSource` to connect to EDB Postgres Advanced Server database or execute SQL directly against it. For more information on the data source, see the [Npgsql documentation](https://www.npgsql.org/doc/basic-usage.html).


<div id="connection_string_parameters" class="registered_link"></div>
Expand Down Expand Up @@ -227,7 +227,7 @@ Compiling the sample generates a `Console.exe` file. You can execute the sample

## Example: Opening a database connection from a Windows form application

This example opens a database connection using a .NET WinForm application. To use the example, save the following code as `WinForm-Example.cs` in a directory that contains the library files.
This example opens a database connection using a .NET WinForm application. To use the example, save the following code as `WinForm-Example.cs` in a directory that contains the library files:

```csharp
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ title: "Retrieving database records"

You can use a `SELECT` statement to retrieve records from the database using a `SELECT` command. To execute a `SELECT` statement you must:

- Create and open a database connection.
- Create an `EDBCommand` object that represents the `SELECT` statement.
- Execute the command with the `ExecuteReader()` method of the `EDBCommand` object returning `EDBDataReader`.
- Loop through the `EDBDataReader`, displaying the results or binding the `EDBDataReader` to some control.
1. Create and open a database connection.
1. Create an `EDBCommand` object that represents the `SELECT` statement.
1. Execute the command with the `ExecuteReader()` method of the `EDBCommand` object returning `EDBDataReader`.
1. Loop through the `EDBDataReader`, displaying the results or binding the `EDBDataReader` to some control.

An `EDBDataReader` object represents a forward-only and read-only stream of database records, presented one record at a time. To view a subsequent record in the stream, you must call the `Read()` method of the `EDBDataReader` object.

Expand Down Expand Up @@ -62,7 +62,7 @@ private void Page_Load(object sender, System.EventArgs e)

```
To exercise the sample code, save the code in your default web root directory in a file named `selectEmployees.aspx`. Then, to invoke the program, enter the following URL in a browser: `http://localhost/selectEmployees.aspx`.
To exercise the sample code, save the code in your default web root directory in a file named `selectEmployees.aspx`. Then, to invoke the program, enter the following in a browser: `http://localhost/selectEmployees.aspx`.
## Retrieving a single database record
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The `CommandType` property of the `EDBCommand` object indicates the type of comm

The `CommandText` property must contain a SQL string, stored procedure name, or table name, depending on the value of the `CommandType` property.

The following example executes the stored procedure:
This example executes the stored procedure:

```cpp
<% @ Page Language="C#" Debug="true"%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ For more information about using EDB Postgres Advanced Server's advanced queuein

### Server-side setup

To use advanced queueing functionality on your .NET application, you must first create a user-defined type, queue table, and queue, and then start the queue on the database server. Invoke EDB-PSQL and connect to the EDB Postgres Advanced Server host database. Use the following SPL commands at the command line:
To use advanced queueing functionality on your .NET application, you must first create a user-defined type, queue table, and queue, and then start the queue on the database server. Invoke EDB-PSQL and connect to the EDB Postgres Advanced Server host database. Use the following SPL commands at the command line.

#### Creating a user-defined type

To specify a RAW data type, create a user-defined type. This example shows creating a user-defined type named as `myxml`:
To specify a RAW data type, create a user-defined type. This example shows creating a user-defined type named `myxml`:

```
CREATE TYPE myxml AS (value XML);
Expand Down Expand Up @@ -62,7 +62,7 @@ END;

### Client-side example

Once you've created a user-defined type, followed by queue table and queue, start the queue. Then, you can enqueue or dequeue a message using EDB .Net drivers.
Once you've created a user-defined type, the queue table, and the queue, start the queue. Then, you can enqueue or dequeue a message using EDB .Net drivers.

#### Enqueue a message

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: "Using a ref cursor in a .NET application"

<div id="using_a_ref_cursor_in_a_net_application" class="registered_link"></div>

A `ref cursor` is a cursor variable that contains a pointer to a query result set. The result set is determined by executing the `OPEN FOR` statement using the cursor variable. A cursor variable isn't tied to a particular query like a static cursor. You can open the same cursor variable a number of times with the `OPEN FOR` statement containing different queries and each time. A new result set is created for that query and made available by way of the cursor variable. You can declare a cursor variable in two ways:
A `ref cursor` is a cursor variable that contains a pointer to a query result set. The result set is determined by executing the `OPEN FOR` statement using the cursor variable. A cursor variable isn't tied to a particular query like a static cursor. You can open the same cursor variable a number of times with the `OPEN FOR` statement containing different queries each time. A new result set is created for that query and made available by way of the cursor variable. You can declare a cursor variable in two ways:

- Use the `SYS_REFCURSOR` built-in data type to declare a weakly typed ref cursor.
- Define a strongly typed ref cursor that declares a variable of that type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ legacyRedirects:

<div id="scram_compatibility" class="registered_link"></div>

The EDB .NET driver provides SCRAM-SHA-256 support for EDB Postgres Advanced Server version 10 and later. This support is available from EDB .NET 4.0.2.1 release and later.
The EDB .NET driver provides SCRAM-SHA-256 support for EDB Postgres Advanced Server version 10 and later. This support is available in EDB .NET 4.0.2.1 release and later.
Loading

1 comment on commit 3621653

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.