Contains + Concat

Posts   
 
    
deathwish
User
Posts: 56
Joined: 07-Nov-2006
# Posted on: 04-Jul-2008 10:53:29   

Hey,

I have been playing with the new LINQ stuff in a project for the last day, I must say that it is really cool. coolj.

I am using v2.6.8.606 with SQL Server 2005.

Here are two queries that I have so far.


var e = from s in metaData.Sample
    where (s.Request.RequestNumber == requestNumber(txtSample.Text))
    select s.Suffix;

var p = from m in metaData.ProjectSample
    where (m.ParentProjectSampleId.Value == projectSampleId)
    orderby m.Name ascending
    select new
    {       
        Name = m.Name,
    };

In the query for e, the s.Suffix is a string that will be something like "S4", "P1" etc.

Now in the second query I need to concat to fields and check that the concat'd field is not in the first query.

I tried adding the Concat function mapping from the help and with some help from the forums but I keep getting an exception:

SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryConstructionException: The operand of the Contains method can't be converted to an entity or a query

This is what I tried adding to the where clause of the second query:


(!e.Contains(CustomFunction.Concat(m.ProjectSampleType.Suffix, m.Instance)))

m.ProjectSampleType.Suffix is a string which will be something like "S" or "P" and m.Instance is an int that will be something like "4" or "1".

Many thanks in advance from a LINQ noob.

PS. I'm timing you, and go...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39870
Joined: 17-Aug-2003
# Posted on: 04-Jul-2008 13:13:40   

heh simple_smile

This problem has been fixed on June 27th. This build hasn't been publicly released yet and will be available later today. See: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=13690

At least try the current latest public build to see if it's not caused by something else.

Frans Bouma | Lead developer LLBLGen Pro