string Contains method in Linq throws error

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Ozzian
Posts: 2
Joined: Wed 02 Dec 2015 10:29

string Contains method in Linq throws error

Post by Ozzian » Wed 16 Dec 2015 07:54

I need to run SQLquery into our database usign DBSet function System.Data.Entity.SqlQuery because lack of jsonb query support in Linq.

After that I add Linq expressions on the result using query = query.Where(x => !string.IsNullOrEmpty(x.FieldName))

All this works perfect and no exceptions is thrown, but when i extended that where part to with
query = query.Where(x => x.FieldName.Contains("partOfTextINeedToFind")) i get into problems:

query.ToList() -->
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

Isn't string.contains method supported in devart linqconnect with postgresql?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: string Contains method in Linq throws error

Post by MariiaI » Wed 16 Dec 2015 13:23

The JSONB data type is supported since LinqConnect 4.4.745 (07-May-15):
http://forums.devart.com/viewtopic.php?f=31&t=31744

Also, please take a look at these methods:
http://www.devart.com/linqconnect/docs/ ... Query.html
http://www.devart.com/linqconnect/docs/ ... mmand.html

As for the "System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary." error, we couldn't reproduce it in our environment with the latest build of LinqConnect 4.5.881.
Please create and send us a small test project with the necessary DDL/DML scripts, with which this error is reproducible. This will significantly speed up the process of determining the cause of the issue and finding the solution for it.

Post Reply