Join issue

May 7, 2013 at 7:41 AM
I what use Join in Linq.js, Is Different with C#?
var table = from c in ctx.Users
                 join p in ctx.Structure
                 on c.StructureID equals p.StructureID.ToString()
                 where c.UserID < 276234
                 select c;
What can I do using linq.js achieve the above functions,it's two tables join by foreign key(ID)
Coordinator
May 7, 2013 at 8:52 AM
Is your query syntax right?
It looks need "into" keyword.
// query syntax
var table = from c in ctx.Users
            join p in ctx.Structure on c.StructureID equals p.StructureID.ToString()
            select c into c
            where c.UserID < 276234
            select c;

// method syntax
var table2 = ctx.Users.Join(ctx.Structure, c => c.StructureID, p => p.StructureID.ToString(), (c, p) => c)
    .Where(c => c.UserID < 276234);

// linq.js
var table = ctx.Users.Join(ctx.Structure, "$.StructureID", "$.StructureID.toString()")
    .Where("$.UserID < 276234");
May 8, 2013 at 1:52 AM
Thank you very much,I understand,Linq.js is very good!