vendredi 14 août 2015

Ef6 dot notation; Join on colums with condition like ,not equals

I am trying to join two tables based on column ID on Table2 to be like column ID on Table1

me.dbSet.Join(me.context.Table2, p => p.ID, e => e.ID, 
(p, e) => new { p, e }).Where(z => z.e.ID== uid)

the sql output :

 SELECT 
    1 AS [C1]  
    FROM  [NG].[T1] AS [Extent1]
    INNER JOIN [NG].[T2] AS [Extent2] ON [Extent1].[ID] = [Extent2].[ID] 
    WHERE [Extent2].[ID] = 'f520f7b3-215d-4dfe-9787-1eb6864fb335'

The sql i am trying to write with linq :

 SELECT 
    1 AS [C1]  
    FROM  [NG].[T1] AS [Extent1]
    INNER JOIN [NG].[T2] AS [Extent2] ON [Extent1].[ID] Like [Extent2].[ID] + '%'
    WHERE [Extent2].[ID] = 'f520f7b3-215d-4dfe-9787-1eb6864fb335'



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire