Skip to content

Instantly share code, notes, and snippets.

@dasch88
dasch88 / EFExtensions.cs
Last active September 4, 2018 01:02 — forked from ondravondra/EFExtensions.cs
C# extension for executing upsert (MERGE SQL command) in EF with MSSQL. Automatically retrieves keys from entity, and combines script into single statement for IEnumerable.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;