Table of Contents

Class PostgreSqlTableMap<TModel>

Namespace
Pipelinez.PostgreSql.Mapping
Assembly
Pipelinez.PostgreSql.dll

Defines a strongly typed mapping from a model object to a PostgreSQL table.

public sealed class PostgreSqlTableMap<TModel>

Type Parameters

TModel

The model type used to produce column values.

Inheritance
PostgreSqlTableMap<TModel>
Inherited Members

Properties

SchemaName

Gets the schema name of the destination table.

public string SchemaName { get; }

Property Value

string

TableName

Gets the table name of the destination table.

public string TableName { get; }

Property Value

string

Methods

ForTable(string, string)

Creates a new empty table map for the specified schema and table.

public static PostgreSqlTableMap<TModel> ForTable(string schemaName, string tableName)

Parameters

schemaName string

The schema name to target.

tableName string

The table name to target.

Returns

PostgreSqlTableMap<TModel>

A new table map instance.

MapJson<TValue>(string, Func<TModel, TValue>)

Adds a column mapping that serializes the produced value as JSON and writes it as jsonb.

public PostgreSqlTableMap<TModel> MapJson<TValue>(string columnName, Func<TModel, TValue> valueFactory)

Parameters

columnName string

The destination column name.

valueFactory Func<TModel, TValue>

The callback that produces the value to serialize.

Returns

PostgreSqlTableMap<TModel>

A new table map with the added JSON column mapping.

Type Parameters

TValue

The value type produced by the mapping.

Map<TValue>(string, Func<TModel, TValue>)

Adds a column mapping that writes a scalar or parameterized value directly.

public PostgreSqlTableMap<TModel> Map<TValue>(string columnName, Func<TModel, TValue> valueFactory)

Parameters

columnName string

The destination column name.

valueFactory Func<TModel, TValue>

The callback that produces the column value from the model.

Returns

PostgreSqlTableMap<TModel>

A new table map with the added column mapping.

Type Parameters

TValue

The value type produced by the mapping.

Validate()

Validates the table map and returns the same instance when valid.

public PostgreSqlTableMap<TModel> Validate()

Returns

PostgreSqlTableMap<TModel>

The validated table map.