title: How to execute raw SQL Query in my Dot net core project? Or how to translate it to Linq?
body: <p>I'm having a hard time finding anything about executing a raw query,
  I have no idea how to translate this to LINQ or if it is even possible.</p>
  
  <p>I have ContactRecords in my DBSet but I don't really want that I guess, I just need to do multiple counts.. raw query..</p>
  
  <p>I need to do multiple COUNTs and use a DB function i created "usp_Parse_domain_name_v5":</p>
  
  <p>This is the Query I'm trying to execute in my DOT NET CORE app:</p>
  
  <pre><code>SELECT
      dbo.usp_Parse_domain_name_v5(ContactRecord.URL),
      COUNT(ContactRecord.ContactId) AS TOTAL_IMPRESSIONS,
      COUNT(DISTINCT ContactAttribute.ContactAttributeValue) AS UNIQUE_IMPRESSIONS,
      COUNT(DISTINCT LEADS.LEAD_ID) AS CONVERSIONS,
      MAX(convert(varchar(10), ContactRecord.CallStartDateTime, 102)) AS 'DATE'
  FROM
      ContactAttribute 
      LEFT JOIN ContactRecord ON ContactRecord.ContactId = ContactAttribute.ContactId AND ContactAttribute.ContactAttributeName = 'IP'
      LEFT JOIN LEADS 
      ON LEADS.LEAD_ID = ContactRecord.ContactId
      AND LEADS.EMAIL IS NOT NULL AND LEADS.PHONENUMBER IS NOT NULL 
      AND LEADS.FIRSTNAME IS NOT NULL AND LEADS.LASTNAME IS NOT NULL
  WHERE
      convert(varchar(10), ContactRecord.CallStartDateTime, 102) = '2019.05.16'
  GROUP BY
      dbo.usp_Parse_domain_name_v5(URL)
  ORDER BY 
      COUNT(ContactRecord.ContactId) DESC;
  </code></pre>