not able to reference PgSqlJsonbFunctions
Posted: Tue 25 Sep 2018 00:47
Hi,
I am trying to get some JSONB functionality working and have been banging my head against the wall way too long now. Hope any of you guys can shed some light here.
So just following all the instructions here (pretty much used the code exactly as provided)
https://www.devart.com/dotconnect/postg ... pport.html
using:
dotConnect: 7.11.1229.0
Devart.Data: 5.0.2021.0
Devart.Data.Postgresql 7.11.1229.0
Devart.Data.Postgresql.Entity.EF6 7.6.763.0
Here's my code:
The problem is that PgSqlJsonbFunctions is not reference from any assembly.
hope someone can shed some light on the problem at hand.
Kind regards Gajus
I am trying to get some JSONB functionality working and have been banging my head against the wall way too long now. Hope any of you guys can shed some light here.
So just following all the instructions here (pretty much used the code exactly as provided)
https://www.devart.com/dotconnect/postg ... pport.html
using:
dotConnect: 7.11.1229.0
Devart.Data: 5.0.2021.0
Devart.Data.Postgresql 7.11.1229.0
Devart.Data.Postgresql.Entity.EF6 7.6.763.0
Here's my code:
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Devart.Data.PostgreSql;
namespace ConsoleApp1
{
public class MyContext : DbContext
{
public DbSet<JsonTable> JsonTables { get; set; }
}
public class JsonTable
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Column(TypeName = "jsonb")]
public string JObject { get; set; }
public string Text { get; set; }
}
class Program
{
static void Main(string[] args)
{
var context = new MyContext();
context.Database.Create();
var query = context.JsonTables
.Where(t => PgSqlJsonbFunctions.GetObjectFieldAsText(t.JObject, "a") == "foo")
.Select(t => new {
Id = t.Id,
Json = t.JObject,
ObjectType = PgSqlJsonbFunctions.TypeOf(t.JObject),
FieldType = PgSqlJsonbFunctions.TypeOf(PgSqlJsonbFunctions.ExtractPath(t.JObject, "a")),
ExtractPath = PgSqlJsonbFunctions.ExtractPath(t.JObject, "a"),
ExtractPathText = PgSqlJsonbFunctions.ExtractPathText(t.JObject, "a"),
GetObjectField = PgSqlJsonbFunctions.GetObjectField(t.JObject, "a"),
GetObjectFieldAsText = PgSqlJsonbFunctions.GetObjectFieldAsText(t.JObject, "a")
});
}
}
}
hope someone can shed some light on the problem at hand.
Kind regards Gajus