title: ASP.NET Web API hide property from EF/LINQ query
body: <p>I have a blog project when C# is the API. I'm using SQL Server 2016. In order to connect to the database I'm using <strong>Entity Framework</strong>.</p>
  
  <p>This is my ADO.NET <em>.edmx</em> diagram:</p>
  
  <p><a href="https://i.stack.imgur.com/d28vM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d28vM.png" alt="enter image description here"></a></p>
  
  <p>A user may have many posts, a post may have many authors (Users), a post may have some comments, and a user may have comments.</p>
  
  <p>When I request the API to fetch a user (or a list of users) that's the response: (Endpoint: "/api/users/1")</p>
  
  <p><a href="https://i.stack.imgur.com/dlEkT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dlEkT.png" alt="enter image description here"></a></p>
  
  <p>I want to hide the password field from the response (I know it's not hashed, but this is for test purposes) so I changed the code from:</p>
  
  <p><a href="https://i.stack.imgur.com/bHjkp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bHjkp.png" alt="enter image description here"></a></p>
  
  <p>To:</p>
  
  <p><a href="https://i.stack.imgur.com/tNqGv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tNqGv.png" alt="enter image description here"></a></p>
  
  <p>This is the result using the new code:</p>
  
  <p><a href="https://i.stack.imgur.com/TsYjl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TsYjl.png" alt="enter image description here"></a></p>
  
  <p><strong>BUT NOW :(</strong> I see the details of the user <strong>(including passowrd!)</strong> in the posts array!</p>
  
  <p>Is there an efficient way to implement hiding sensitive data from EF/LINQ queries in C# Web API?</p>
  
  <p>Thanks.</p>