Any high level .NET clients for the PostgreSQL JSON type?
We evaluate PostgreSQL as a NoSQL doc file store using its json / jsonb datatype.
ElasticSearch has a very good high level client library with NEST . In some way similar to NHibernate, you can simply save the POCO classes and queries can be executed in a generic way on the properties of the class.
So far, the only client support I've found for Postgres around its json type is:
- Use Npgsql or a similar low-level client to access the raw SQL, which can then use special operators supported by Postgres for JSON Query.
- Just deserialize to a JSON object in my application and do any request to the internal object there. This is the method to be used with NHibernate, for example, as I understand it.
Are there any client libraries like NEST for the Postgres JSON datatype that can use their special operators to allow queries and column / property selections in the database rather than doing them in my application?
source to share
Edit
I switched to Marten because he is more mature and has more community support.
Original
I recently came across elephanet . It is a RavenDb client affecting .NET for using PostgreSQL as a document database. Including support for json documents and jsonb indexing for fast retrieval.
DocumentStore store = new DocumentStore("Server=127.0.0.1;Port=5432;User Id=store_user;password=my super secret password;database=store;");
//create the object
var myAudi = new Car {
Id = Guid.NewGuid(),
Make = "Audi",
Model = "A8",
ImageUrl = "http://some_image_url",
NumberPlate = "ABC029"
};
//save the object to the document store
using (var session = store.OpenSession())
{
session.Store<Car>(myAudi);
session.SaveChanges();
}
source to share