title: Entity Framework Core Declare table variable, insert values to it and use this with 'where not exists'
body: <p>Because a </p>
  
  <pre><code>SELECT * FROM visits where id not in (1,2,3,4,5,6,...)
  </code></pre>
  
  <p>with 100's of IDs is really slow, I'd like to use a declared table and do a 'where not exists' on it, like:</p>
  
  <pre><code>DECLARE @list Table(ID int);
  INSERT INTO @list VALUES (192000),(934282),(991116),(235091),(89709),(282605),(339057),(368062),(512013),(536548),(94714),(197477),(654839),(848893),(15917),(476700),(909048),(536400),(823404),(777915),(228055),(492591),(439780),(493784),(732689),(328185),(620171),(183835),(373595),(536869), ...;
  INSERT INTO @list VALUES (3),(5);
  SELECT TOP (1000) [Id]
        ,[IsDeleted]
        ,[Url]
        ,[Username]
        ,[VisitDate]
    FROM [dbo].[Site].[Visits] v
    where not exists (select id from @list l where l.ID =  v.Id)
  </code></pre>
  
  <p>However, I'd like to use LINQ-to-Entities of Entity Framework Core 2.0 to add other .Where() clauses and the .OrderBy, .Take(), ... functionalities on the Visits.</p>
  
  <p>Can this query be translated to LINQ-To-Entities or atleast to an IQueryable where I can use extension functions on afterwards?
  I'm using ASP.NET Core 2.0.5 and the database is an MSSQL Server 2016.</p>