Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public class RandomDto
  2. {
  3. public int Id {get;set;}
  4. public ChildDto FirstChild {get;set;}
  5. public ChildDto SecondChild {get;set;}
  6. }
  7.  
  8. SELECT CASE
  9. WHEN [dtoRandom].[FirstChild_FK] IS NULL
  10. THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT)
  11. END, [t0].[Child_Description]
  12. END, [dtoRandom].[Id]
  13. FROM [Randoms] AS [dtoRandom]
  14. INNER JOIN (
  15. SELECT [s].*
  16. FROM [Childs] AS [s]
  17. ) AS [t0] ON [dtoRandom].[FirstChild_FK] = [t0].[Id]
  18.  
  19. .ProjectTo<RandomDto>(null, "FirstChild", "SecondChild")
  20. .ProjectTo<RandomDto>(x=>x.FirstChild, x=>x.SecondChild)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement