/// <summary> /// Detaches the navigation properties. /// </summary> /// <param name="entry">The entry.</param> /// <exception cref="ArgumentNullException">entry</exception> public static void DetachNavigationProperties(this EntityEntry entry) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } var parentEntities = new HashSet <object>(); entry.Detach(parentEntities); }