C# entity framework when join two table
<p>I have some tables,using Entity Framework</p>

<p><strong>UserTable</strong></p>

<ul>
<li>UserID</li>
</ul>

<p><strong>BookTable</strong></p>

<ul>
<li>BookID</li>
<li>BookName</li>
</ul>

<p><strong>OwnTable</strong></p>

<ul>
<li>UserID</li>
<li>BookID</li>
</ul>

<p>now I can use:</p>

<pre><code>uw.ownRepository.GetData().where(v=&gt;v.userid=1).select(o=&gt;o.Book)
</code></pre>

<p>to get all the book I own.But If I want to get all the books , and note that whether the user own it or not</p>

<p>I have some solution</p>

<p>1.</p>

<p>select all the book,
then for each one select once</p>

<p>stupid solution = ="</p>

<p>2.</p>

<pre><code>    var s = from book in uw.bookRepository.GetData()                    
    join own in uw.ownRepository.GetData() on book.Id equals like.Id into ps
    from o in ps.DefaultIfEmpty()
    select new {bookName =book.name,IsOwn =o==null};
</code></pre>

<p>just some pseudocode.</p>

<p>I tried it and works fine.</p>

<p>But I'm wondering if there is another better solution</p>

<p>if I want to select a strong type like</p>

<pre><code>    select new Book{bookName =book.name,bookType=book.bookType, IsOwn =o==null};
</code></pre>

<p>in this case , if I have many field in bookTable , i have to assign every field.</p>

<p>Does anybody have some idea?</p>
