title: c# entityframework join 2 tables and check if value exist
body: <p>I want to join 2 tables using EF and check if there is any value</p>
  
  <pre><code>public bool IsSubscriptionExist(string domain)
  {
      try
      {
          using (AccContext db = new AccContext ())
          {
              var count = (from s in db.Subscriptions
                           join a in db.Allias on s.Id equals a.Subscription_Id 
                           where (s.Domain == domain || a.Allias_Domain == domain)
                           select s).Count();
  
              return count &gt; 0;
          }
      }
      catch (Exception ex)
      {
          customLogManager.Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
          throw ex;
      }
  }
  </code></pre>
  
  <p>The problem is that count returns 0 while subscription record is exist, I think because Allias is not exist. This is the same as join/left join I believe.</p>
  
  <p>Is there any way to count even if Allias not exist ?   </p>