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
- Host: GitHub
- URL: https://github.com/beginor/nhibernate-npgsql
- Owner: beginor
- License: mit
- Archived: true
- Created: 2017-07-14T03:22:58.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-04-23T10:52:30.000Z (about 4 years ago)
- Last Synced: 2025-08-01T07:25:40.847Z (11 months ago)
- Language: C#
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 !