Note that there are some explanatory texts on larger screens.

plurals
  1. POFiltering sets of data from within another set
    primarykey
    data
    text
    <p>I've been reading the docs and tutorials on LINQ queries but can't seem to get it right. I have a model similar to this one and am using entity framework to persist it:</p> <pre><code>public class Question { public int Id {set;get;} public string Question {set;get;} public DateTime DateCreated {get;set;} public List&lt;Answer&gt; Answers {set; get;} } public class Answer { public int Id {set; get;} public string UserAnswer {get;set;} public DateTime DateAnswered {get;set;} public User TheUserWhoAnswerd {get;set;} } public class User { public int Id { get;set;} public string UserName {get;set;} public DateTime DateCreated {get;set;} public List&lt;Question&gt; Questions { get;set;} } The data context has something like this public HashSet&lt;Question&gt; AllOfTheQuestionsDb {get;set;} public HashSet&lt;Answer&gt; AllOfTheAnswersDb {get;set;} public HashSet&lt;User&gt; AllOfTheUsersDb {get;set;} </code></pre> <p>My flow is similar to stack overflow --trivia style.</p> <p>The system can assign questions to users (question are generated by the system i.e. admin , and initially don't belong to anyone). After that, the same questions can be assigned to multiple different users. each user can then answer the question.</p> <p>The question holds a list of answers that were given to it.</p> <p>So for instance if question 1 was assigned to users 1 through 10, but only user 2 and 4 answered, that question will only have 2 answers in the "Answers list".</p> <p>My goal is to be able to do some basic sorts and selects on the data source.</p> <p>For instance:</p> <ol> <li><p>For a given user - UserA -, return all questions where UserA <strong>did not</strong> answer that question.</p></li> <li><p>for all questions in system, return all users that the question was assigned to but that user did/didn't answer</p></li> <li><p>selecting questions and answers for a user that were/were not answered after a given date</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    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.
 

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