An open API service indexing awesome lists of open source software.

https://github.com/beginor/nhibernate-npgsql

PostgreSQL extension for NHibernate
https://github.com/beginor/nhibernate-npgsql

Last synced: 5 months ago
JSON representation

PostgreSQL extension for NHibernate

Awesome Lists containing this project

README

          

This project is no longer maintained. Take a look at the [NHibernate Extensions for .NET Core project](https://github.com/beginor/nhibernate-extensions) for the following extentions:

- [NHibernate.Extensions.NpgSql](https://github.com/beginor/nhibernate-extensions#nhibernateextensionsnpgsql)
- [NHibernate.Extensions.Sqlite](https://github.com/beginor/nhibernate-extensions#nhibernateextensionssqlite)
- [NHibernate.NetCore](https://github.com/beginor/nhibernate-extensions#nhibernatenetcore)

----
# Beginor.NHibernate.NpgSql

NHibernate Extension for supporting of PostgreSQL's `json`, `jsonb` and
`string[]` field.

## Usage

### 1. Set `connection.driver_class` to `Beginor.NHibernate.NpgSql.NpgSqlDriver,Beginor.NHibernate.NpgSql` as flow:

```xml


Beginor.NHibernate.NpgSql.NpgSqlDriver,Beginor.NHibernate.NpgSql
NHibernate.Dialect.PostgreSQL82Dialect

```

### 2. Reference the types needed to mapping file

`TestEntity.hbm.xml`

```xml



```

### 3. Use theme in mapping file

```xml



public.test_table_id_seq






```

`TestEntity` is something like:

```cs
using System;

namespace Beginor.NHibernate.NpgSql.Test.Data {

public class TestEntity {

public virtual int Id { get; set; }

public virtual string Name { get; set; }

public virtual string[] Tags { get; set; }

public virtual string JsonField { get; set; }

public virtual string JsonbField { get; set; }

public virtual DateTime UpdateTime { get; set; }
}

}
```

Done !