Page 1 of 1

Contains is not supported for execution as SQL

Posted: Wed 21 Oct 2015 12:15
by Marcel Normann
I am trying to bring a CONTAINS-query with Linqconnect in VS2015 to work.

References are
Devart.Data 5.0.1298.0
Devart.Data.Linq 4.5.844.0
Devart.Data.Linq.Web 4.5.844.0
Devart.Data.Oracle 8.5.506.0
Devart.Data.Oracle.Entity 8.5.506.6
Devart.Data.Oracle.Linq 4.5.844.0

Code: Select all

SQL> select count(1) from per_xml_profiles where contains(profile, 'Hash') > 0;

  COUNT(1)
----------
        29

Code: Select all

var matches = db.PersonXmlProfiles.Where(prj => OracleTextFunctions.Contains(prj.Profile, "Hash", 1) > 0);

Code: Select all

System.InvalidOperationException: Method 'System.Nullable`1[System.Double] Contains(System.String, System.String, System.Nullable`1[System.Int32])' is not supported for execution as SQL.
   bei Devart.Data.Linq.Engine.SqlFormatter.Visitor.a(SqlNode A_0)
...
Any suggestions?

Re: Contains is not supported for execution as SQL

Posted: Thu 22 Oct 2015 09:27
by MariiaI
The OracleTextFunctions class is related to Entity Framework support, not LinqConnect, and is available in Devart.Data.Oracle.Entity (8.5.506.6) assembly (this assembly is related to Entity Framework support, too). This is two different ORM solutions and, thus, different classes, assemblies are used.
To be able to use only LinqConnnect, you should add references for:
Devart.Data 5.0.1298.0
Devart.Data.Linq 4.5.844.0
Devart.Data.Linq.Web 4.5.844.0
Devart.Data.Oracle 8.5.506.0
Devart.Data.Oracle.Linq 4.5.844.0


You can try using such query:

Code: Select all

var matches = db.DEPTs.Where(prj => prj.DNAME.Contains("Hash")).ToList();
Also, some useful information:
https://www.devart.com/linqconnect/docs ... mbers.html
http://forums.devart.com/viewtopic.php?t=14937
http://stackoverflow.com/questions/2369 ... inq-to-sql