Skip to content

Instantly share code, notes, and snippets.

@extstopcodepls
extstopcodepls / IQueryableExtensions.cs
Created December 30, 2024 12:14 — forked from ErikEJ/IQueryableExtensions.cs
Replacement for EF Core .Contains, that avoids SQL Server plan cache pollution
using System.Linq.Expressions;
namespace Microsoft.EntityFrameworkCore
{
public static class IQueryableExtensions
{
public static IQueryable<TQuery> In<TKey, TQuery>(
this IQueryable<TQuery> queryable,
IEnumerable<TKey> values,
Expression<Func<TQuery, TKey>> keySelector)
@extstopcodepls
extstopcodepls / gist:f4be8f425784706f9ceb6fc2ce0e1de2
Created February 28, 2019 14:33 — forked from DexterHaslem/gist:3249480
AutomationElement pinvoke right click
// add references WindowsBase, UIAutomationClient, UIAutomationTypes
// using System.Windows.Automation;
// using System.Windows;
[DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
public void RightClick(AutomationElement element)
{
const int WM_LBUTTONDOWN = 0x0201;
const int WM_LBUTTONUP = 0x0202;
Point point = element.GetClickablePoint();