public IActionFacade GetAction(IFrameworkFacade facade) { if (actionFacade == null) { var no = GetNakedObject(facade); IActionFacade action; if (no.Specification.IsCollection) { var elementSpec = no.ElementSpecification; action = elementSpec.GetCollectionContributedActions().Where(a => a.IsVisible(no)).Single(a => a.Id == ActionId); } else { var id = facade.OidTranslator.GetOidTranslation(no); action = facade.GetObjectAction(id, ActionId).Action; } actionFacade = action.IsUsable(no).IsAllowed ? action : null; } return(actionFacade); }
public static ActionContextFacade GetObjectActionByName(this IFrameworkFacade frameworkFacade, string domainType, string instanceId, string actionName) { var oidTranslation = frameworkFacade.OidTranslator.GetOidTranslation(domainType, instanceId); return(frameworkFacade.GetObjectAction(oidTranslation, actionName)); }
public IActionFacade GetAction(IFrameworkFacade facade) { if (actionFacade == null) { var no = GetNakedObject(facade); IActionFacade action; if (no.Specification.IsCollection) { var elementSpec = no.ElementSpecification; action = elementSpec.GetCollectionContributedActions().Where(a => a.IsVisible(no)).Single(a => a.Id == ActionId); } else { var id = facade.OidTranslator.GetOidTranslation(no); action = facade.GetObjectAction(id, ActionId).Action; } actionFacade = action.IsUsable(no).IsAllowed ? action : null; } return actionFacade; }