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
TModelThe 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
TableName
Gets the table name of the destination table.
public string TableName { get; }
Property Value
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
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
columnNamestringThe destination column name.
valueFactoryFunc<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
TValueThe 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
columnNamestringThe destination column name.
valueFactoryFunc<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
TValueThe 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.