Created
May 5, 2013 04:28
-
-
Save karthik25/5519699 to your computer and use it in GitHub Desktop.
This is a fluent extension that adds RemoveAll method to IDbSet<T>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| using System.Data.Entity; | |
| using System.Linq; | |
| namespace MyApp.Domain.FluentExtensions | |
| { | |
| public static class DbSetFluentExtensions | |
| { | |
| public static IEnumerable<T> RemoveAll<T>(this IDbSet<T> src, IEnumerable<T> list) | |
| where T : class | |
| { | |
| var items = list.ToList(); | |
| foreach (var instance in items) | |
| { | |
| src.Remove(instance); | |
| } | |
| return items; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment