public static void ShareEntityContext(this IIntermediateEntityContainer container, IntermediateEntity entity) { //You can't share context with a null, right? if (entity != null) { var parent = container.GetParent(); if (entity.EntityContext != null && parent.EntityContext == null) { entity.EntityContext.AttachContext(parent); } else if (parent.EntityContext != null && entity.EntityContext == null) { parent.EntityContext.AttachContext(entity); } } }
public static void SetEntityContextOnParent(this IIntermediateEntityContainer container, EntityContext context) { context.AttachContext(container.GetParent()); }