public void Handle(SetParentCommand command, ICommandExecutionContext context)
 {
     foreach (var formerParentId in context.GetRelated(this, x => x.Parent))
     {
         context.Detach(this, x => x.Parent, formerParentId);
     }
     context.Attach(this, x => x.Parent, command.ParentNodeId);
 }
示例#2
0
 public void Handle(SetHierarchyRootCommand command, ICommandExecutionContext context)
 {
     foreach (var formerRootId in context.GetRelated(this, x => x.RootNode))
     {
         context.Detach(this, x => x.RootNode, formerRootId);
     }
     context.Attach(this, x => x.RootNode, command.NodeId);
 }
示例#3
0
 public static IEnumerable <ObjectId> GetRelated <TCommand, TTarget, TValue>(this ICommandExecutionContext context, ITypedCommandHandler <TCommand, TTarget> handler, Expression <Func <TTarget, TValue> > propertyExpression)
     where TCommand : TypedCommand <TTarget>
 {
     return(context.GetRelated(GetRelationName(propertyExpression)));
 }