# PostgresServerResource Properties

- Package: [Aspire.Hosting.PostgreSQL](/reference/api/csharp/aspire.hosting.postgresql.md)
- Type: [PostgresServerResource](/reference/api/csharp/aspire.hosting.postgresql/postgresserverresource.md)
- Kind: `Properties`
- Members: `10`

A resource that represents a PostgreSQL container.

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L67-L72)

Gets the connection string expression for the PostgreSQL server.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

## Databases

- Name: `Databases`
- Modifiers: `get`
- Returns: `IReadOnlyDictionary<string, string>`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L96)

A dictionary where the key is the resource name and the value is the database name.

```csharp
public IReadOnlyDictionary<string, string> Databases { get; }
```

## Host

- Name: `Host`
- Modifiers: `get`
- Returns: `EndpointReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L109)

Gets the host endpoint reference for this service.

```csharp
public EndpointReferenceExpression Host { get; }
```

## JdbcConnectionString

- Name: `JdbcConnectionString`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L167)

Gets the JDBC connection string for the PostgreSQL server.

```csharp
public ReferenceExpression JdbcConnectionString { get; }
```

## Remarks

Format: `jdbc:postgresql://{host}:{port}`.

User and password credentials are not included in the JDBC connection string. Use the `Username` and `Password` connection properties to access credentials.

## PasswordParameter

- Name: `PasswordParameter`
- Modifiers: `get; set`
- Returns: `ParameterResource`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs)

Gets or sets the parameter that contains the PostgreSQL server password.

```csharp
public ParameterResource PasswordParameter { get; set; }
```

## Port

- Name: `Port`
- Modifiers: `get`
- Returns: `EndpointReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L114)

Gets the endpoint reference expression that identifies the port for this endpoint.

```csharp
public EndpointReferenceExpression Port { get; }
```

## PrimaryEndpoint

- Name: `PrimaryEndpoint`
- Modifiers: `get`
- Returns: `EndpointReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L33)

Gets the primary endpoint for the PostgreSQL server.

```csharp
public EndpointReference PrimaryEndpoint { get; }
```

## UriExpression

- Name: `UriExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L122)

Gets the connection URI expression for the PostgreSQL server.

```csharp
public ReferenceExpression UriExpression { get; }
```

## Remarks

Format: `postgresql://{user}:{password}@{host}:{port}`.

## UserNameParameter

- Name: `UserNameParameter`
- Modifiers: `nullable` `get; set`
- Returns: `ParameterResource?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs)

Gets or sets the parameter that contains the PostgreSQL server user name.

```csharp
public ParameterResource? UserNameParameter { get; set; }
```

## UserNameReference

- Name: `UserNameReference`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.PostgreSQL/PostgresServerResource.cs#L47-L49)

Gets a reference to the user name for the PostgreSQL server.

```csharp
public ReferenceExpression UserNameReference { get; }
```

## Remarks

Returns the user name parameter if specified, otherwise returns the default user name "postgres".
