/// <summary> /// 验证辅助 /// </summary> /// <param name="dataAction">辅助参数</param> private void ValidateAction(IDataAction dataAction) { if (dataAction is null) { throw new ArgumentNullException(nameof(dataAction)); } ValidateParameter(dataAction); ValidateParameter(Merchant); }
public ProductController( IDataRepository <Product, ProductEditViewModel> productRepository, IDataRepository <Category, Category> categoryRepository, IMemoryCache memoryCache, IDataAction dataAction) { this.productRepository = productRepository; this.categoryRepository = categoryRepository; this.memoryCache = memoryCache; this.dataAction = dataAction; }
private void AddToDataAction(IESpace espace, ILink l, IDataAction action, String sname) { var lib = espace.References.Single(a => a.Name == "FeatureToggle_Lib"); var getToggleAction = (IServerActionSignature)lib.ServerActions.Single(a => a.Name == "FeatureToggle_IsOn"); var keyParam = getToggleAction.InputParameters.Single(s => s.Name == "FeatureToggleKey"); var modParam = getToggleAction.InputParameters.Single(s => s.Name == "ModuleName"); var start = action.GetAllDescendantsOfType <IStartNode>().Single(); var assign = action.GetAllDescendantsOfType <IAssignNode>().Single(); var destname = sname; if (l != null) { destname = GetDestinationName(l); } var startTarget = start.Target; var getToggle = action.CreateNode <IExecuteServerActionNode>().Below(start); getToggle.Action = getToggleAction; getToggle.SetArgumentValue(keyParam, $"Entities.FeatureToggles.FT_{espace.Name}_{destname}"); getToggle.SetArgumentValue(modParam, "GetEntryEspaceName()"); getToggle.Name = $"FT_{destname}_IsOn"; var outputparam = action.CreateOutputParameter($"FT_{destname}"); outputparam.DataType = espace.BooleanType; if (assign != null) { assign.CreateAssignment($"FT_{destname}", $"FT_{destname}_IsOn.IsOn"); getToggle.Target = startTarget; } else { assign = action.CreateNode <IAssignNode>().Below(getToggle); assign.CreateAssignment($"FT_{destname}", $"FT_{destname}_IsOn.IsOn"); getToggle.Target = assign; assign.Target = startTarget; } start.Target = getToggle; }
private void CreateDataAction(IESpace espace, ILink l, IDataAction oninitaction, String sname) { var start = oninitaction.CreateNode <IStartNode>(); var getToggle = oninitaction.CreateNode <IExecuteServerActionNode>().Below(start); var end = oninitaction.CreateNode <IEndNode>(); var lib = espace.References.Single(a => a.Name == "FeatureToggle_Lib"); var getToggleAction = (IServerActionSignature)lib.ServerActions.Single(a => a.Name == "FeatureToggle_IsOn"); getToggle.Action = getToggleAction; start.Target = getToggle; var keyParam = getToggleAction.InputParameters.Single(s => s.Name == "FeatureToggleKey"); var modParam = getToggleAction.InputParameters.Single(s => s.Name == "ModuleName"); var destname = sname; if (l != null) { destname = GetDestinationName(l); } getToggle.SetArgumentValue(modParam, "GetEntryEspaceName()"); getToggle.SetArgumentValue(keyParam, $"Entities.FeatureToggles.FT_{espace.Name}_{destname}"); getToggle.Name = $"FT_{destname}_IsOn"; var outputparam = oninitaction.CreateOutputParameter($"FT_{destname}"); outputparam.DataType = espace.BooleanType; var assignVar = oninitaction.CreateNode <IAssignNode>().Below(getToggle); assignVar.CreateAssignment($"FT_{destname}", $"FT_{destname}_IsOn.IsOn"); getToggle.Target = assignVar; end.Below(assignVar); assignVar.Target = end; }
public void SetAction(IDataAction dataAction) { actions = dataAction.Execute; }