public static IReadOnlyCollection <string[]> ListLeafKeyPaths <T>(this Include <T> include) { var rootNode = include.CreateChainNode(); var @paths = ChainNodeTree.ListLeafKeyPaths(rootNode); return(@paths); }
/// <summary> /// Set to null all properties except included /// </summary> /// <typeparam name="T"></typeparam> /// <param name="entity"></param> /// <param name="include"></param> public static void Detach <T>(T entity, Include <T> include) where T : class { var chainNode = include.CreateChainNode(); var paths = ChainNodeTree.ListLeafKeyPaths(chainNode); DetachRecursive(entity, paths); }
public static void DetachAll <TCol, T>(IEnumerable <T> entities, Include <T> include) where TCol : IEnumerable <T> { var chainNode = include.CreateChainNode(); var paths = ChainNodeTree.ListLeafKeyPaths(chainNode); foreach (var entity in entities) { if (entity != null) { DetachRecursive(entity, paths); } } }