Skip to content

Instantly share code, notes, and snippets.

View TylerCarlson1's full-sized avatar

Tyler Carlson TylerCarlson1

  • Gyrodata
  • Houston TX
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using AutoMapper;
namespace MapTests
{
public class Program
{
@TylerCarlson1
TylerCarlson1 / gist:c12da95bf9cdd935b01b
Created October 19, 2015 19:37
EF 6 Delete Orphan Entities
public interface IDeleteOrphans
{
void DeleteOrphanedEntries();
}
public class DeleteOrphans<T> : IDeleteOrphans
where T : DbContext, IObjectContextAdapter
{
private readonly T _contextAdapter;
private readonly IList<PropertyInfo> _propertyInfos;