Skip to content

Commit 70dc51f

Browse files
authored
Update DbContextExtensions.cs
1 parent a3e7b13 commit 70dc51f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

GraphDiff/GraphDiff/DbContextExtensions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ public static class DbContextExtensions
2121
/// <param name="context">The database context to attach / detach.</param>
2222
/// <param name="entity">The root entity.</param>
2323
/// <param name="mapping">The mapping configuration to define the bounds of the graph</param>
24+
/// <param name="allowDelete">NEED TEXTE!!!!</param>
2425
/// <returns>The attached entity graph</returns>
25-
public static T UpdateGraph<T>(this DbContext context, T entity, Expression<Func<IUpdateConfiguration<T>, object>> mapping = null) where T : class, new()
26+
public static T UpdateGraph<T>(this DbContext context, T entity, Expression<Func<IUpdateConfiguration<T>, object>> mapping = null, bool allowDelete = true) where T : class, new()
2627
{
27-
var root = mapping == null ? new GraphNode() : new ConfigurationVisitor<T>().GetNodes(mapping);
28-
var graphDiffer = new GraphDiffer<T>(root);
29-
return graphDiffer.Merge(context, entity);
28+
var root = mapping == null ? new GraphNode() : new ConfigurationVisitor<T>().GetNodes(mapping);
29+
root.AllowDelete = allowDelete;
30+
var graphDiffer = new GraphDiffer<T>(root);
31+
return graphDiffer.Merge(context, entity);
3032
}
3133

3234
// TODO add IEnumerable<T> entities

0 commit comments

Comments
 (0)