Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity frame work: many to many relationship tables
    primarykey
    data
    text
    <p>I have a news entity and I get the news based on their NewsID. Now I defined a new entity , a Group and I want to get the news based on their Group ID. I defined a Group news Table Aslo to relate this to table together. <img src="https://i.stack.imgur.com/fbAwS.png" alt="enter image description here"></p> <p>in news model I have :</p> <pre><code>public virtual ICollection&lt;GroupNews&gt; RelatedGroupID { get; set; } </code></pre> <p>So I Assumed that I defined the GroupNews table values and I can use it in NewsService.</p> <p>Now lets look at NewsService : </p> <pre><code> Expression&lt;Func&lt;News, bool&gt;&gt; constraint = null; if (user_id &gt; 0 &amp;&amp; project_id &gt; 0) { constraint = e =&gt; (e.CreatorID == user_id &amp;&amp; e.RelatedProjectTags.Any(p =&gt; p.ProjectID == project_id)); } else if (user_id &gt; 0) { constraint = e =&gt; (e.CreatorID == user_id); } else if (project_id &gt; 0) { constraint = e =&gt; (e.RelatedProjectTags.Any(p =&gt; p.ProjectID == project_id)); } else { constraint = null; } IEnumerable&lt;News&gt; result_list = null; if (constraint != null) { result_list = newsRepository.GetMany(constraint).OrderByDescending(e =&gt; e.CreatedOn).Skip(offset); } else { result_list = newsRepository.GetAll().OrderByDescending(e =&gt; e.CreatedOn).Skip(offset); } if (count &gt; 0) { result_list = result_list.Take(count); } return result_list.ToList&lt;News&gt;(); } </code></pre> <p>}</p> <p>I add this line to it in order to define a constraint based on GroupID.</p> <pre><code> else if (groupId &gt; 0) { constraint = e =&gt; (e.RelatedGroupID.Any(n =&gt; n.GroupID == groupId)); } </code></pre> <p>it seems wrong and gives me this error :</p> <blockquote> <p>{"Invalid object name 'dbo.GroupNewsNews'."}</p> </blockquote>
    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.
 

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