public ModuleBuilder( IModuleRepository moduleRepository, IElementTypeTemplateMapper elementMapper, IControlTypeTemplateMapper controlMapper, IValidationAttributeJsConverterMapper validationMapper ) { _moduleRepository = moduleRepository; _elementMapper = elementMapper; _controlMapper = controlMapper; _validationMapper = validationMapper; }
public FlowBuilder( IElementTypeTemplateMapper elementMapper, IControlTypeTemplateMapper controlMapper, IValidationAttributeJsConverterMapper validationMapper, string name ) { _elementMapper = elementMapper; _controlMapper = controlMapper; _validationMapper = validationMapper; Flow = new FlowDefinition(); Flow.TaskPath = typeof(TFlowDataType).Name.FirstCharToLower(); Flow.DataType = typeof(TFlowDataType); Flow.ContextType = typeof(TContextType); Flow.Flow = name; Flow.Steps = new List <Element>(); Flow.Tasks = new List <TaskDefinition>(); }
public CollectionBuilder(TParentType parent, string name, IElementTypeTemplateMapper elementMapper, IControlTypeTemplateMapper controlMapper, IValidationAttributeJsConverterMapper validationMapper, ElementType elementType = ElementType.Object) { Parent = parent; _elementMapper = elementMapper; _controlMapper = controlMapper; _validationMapper = validationMapper; Element = new Element { Name = name, ElementType = elementType, DataType = typeof(TDataType), Elements = new List <Element>(), UiTemplate = elementMapper.GetDefault(elementType), ControlType = null }; }
public static ICollection <ValidatorData> Generate(ICollection <object> attrs, IValidationAttributeJsConverterMapper validatorMapper) { var validators = new List <ValidatorData>(); foreach (var attr_ in attrs) { var attr__ = (Attribute)attr_; if (attr__.GetType().BaseType == typeof(ValidationAttribute) || attr__.GetType().BaseType == typeof(RequiredAttribute)) { var attrName = attr__.GetType().Name; var validator = validatorMapper.GetValidator(attrName).Invoke(attr_); if (validator != null) { validators.Add(validator); } } } return(validators.Count > 0 ? validators : null); }