Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using EF, left outer joins can be performed via GroupJoin. More information on joins can be found at <a href="http://msdn.microsoft.com/en-us/library/bb896266.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb896266.aspx</a>. Here is another example which may help. <a href="http://msdn.microsoft.com/en-us/library/vstudio/bb397895.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/vstudio/bb397895.aspx</a>. As for the projection, that can be performed using an anonymous type such as </p> <pre><code>select new { Amount = 108, Message = "Hello" } </code></pre> <p>Your query might look something like</p> <pre><code>var query = from qf in context.QuizFamilies join images in context.Images on qf.ImagesID = images.ID into quizImages join imageData in context.ImageData on images.ImageDataID = imageData.ID into imgdata from images in quizImages.DefaultIfEmpty() from imageData in imgdata.DefaultIfEmpty() select new { Id = qf.ID, Title = qf.Title, Uri = imageData.Uri}; </code></pre> <h3>Update</h3> <p>If you wanted to change the default Get implementation you can simply remove the code and update the method signature. You can't return an anonymous type so if you still only want those 3 fields you'll need an additional class. I would personally leave the default Get method alone and add another method</p> <pre><code>public class QuizFamilyTitleAndUri { public String Id {get; set;} public String Title {get; set;} public Uri ImageUri {get; set;} } public IEnumerable&lt;QuizFamilyTitleAndUri&gt; GetQuizFamilies() { return var query = from qf in db.QuizFamilies join images in db.Images on qf.ImagesID = images.ID into quizImages join imageData in db.ImageData on images.ImageDataID = imageData.ID into imgdata from images in quizImages.DefaultIfEmpty() from imageData in imgdata.DefaultIfEmpty() select new QuizFamilyTitleAndUri() { Id = qf.ID, Title = qf.Title, ImageUri = imageData.Uri}; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload