public ManagedList(IBase baseObject, IGeneratorConfiguration generatorConfiguration) : base(baseObject, generatorConfiguration) { var title = baseObject.GetDisplayName(); var name = baseObject.GetNavigationName(); this.Title = title; this.Name = name; }
public void HandleValidations(IBase baseObject, IValidationSet validationSet, Attribute[] attributes) { var requiredAttribute = attributes.OfType <RequiredAttribute>().Single(); var errorMessage = string.Format("{0} is required", baseObject.GetDisplayName()); var candidateKey = errorMessage.ToConstantName(); var key = validationSet.AddTranslation(baseObject, candidateKey, errorMessage, true); validationSet.AddValidationEntry("required", "Validators.required", key, "Required Value", null); }
public Response(IBase baseObject, IGeneratorConfiguration generatorConfiguration) : base(baseObject, generatorConfiguration) { var gridColumnAttribute = baseObject.GetFacetAttribute <GridColumnAttribute>(); var displayName = baseObject.GetDisplayName(); var name = baseObject.GetNavigationName(); this.Title = displayName; this.Name = name; this.GridColumnKind = gridColumnAttribute.GridColumnKind; this.IsTextIdentifier = gridColumnAttribute.IsTextIdentifier; this.IsKey = baseObject.HasFacetAttribute <KeyAttribute>(); }
public void HandleValidations(IBase baseObject, IValidationSet validationSet, Attribute[] attributes) { var maxLengthAttribute = attributes.OfType <MaxLengthAttribute>().Single(); var name = baseObject.GetDisplayName(); var length = maxLengthAttribute.Length; var errorMessage = maxLengthAttribute.ErrorMessage ?? string.Format("Maximum of {0} characters", length); var candidateKey = errorMessage.ToConstantName(); var key = validationSet.AddTranslation(baseObject, candidateKey, errorMessage, true); var validValue = length.CreateTestStringOfLength(); var invalidValue = (length + 1).CreateTestStringOfLength(); validationSet.AddValidationEntry("required", string.Format("Validators.maxLength({0})", maxLengthAttribute.Length), key, validValue, invalidValue); }
public ServiceMethod(IBase baseObject, string prefix, string serviceName, string parmsSignature, IGeneratorConfiguration generatorConfiguration) : base(baseObject, generatorConfiguration) { var displayName = prefix + baseObject.GetDisplayName(); var name = prefix + baseObject.GetNavigationName(); this.ServiceMethodKind = EnumUtils.GetValue <ServiceMethodKind>(prefix); this.Name = name; this.ServiceName = serviceName; this.ParmsSignature = parmsSignature; switch (this.ServiceMethodKind) { case ServiceMethodKind.List: this.HttpMethod = "GET"; this.ReturnType = "IEnumerable<dynamic>"; break; case ServiceMethodKind.Create: this.HttpMethod = "POST"; this.ReturnType = "void"; break; case ServiceMethodKind.Get: this.HttpMethod = "POST"; this.ReturnType = "dynamic"; break; case ServiceMethodKind.Update: this.HttpMethod = "PUT"; this.ReturnType = "void"; break; case ServiceMethodKind.Delete: this.HttpMethod = "DELETE"; this.ReturnType = "void"; break; } this.MethodFullSignature = $"{ this.ReturnType } { this.ServiceName }.{ this.Name }({ this.ParmsSignature })"; this.MethodSignature = $"public { this.ReturnType } { this.Name }({ this.ParmsSignature })"; this.InterfaceSignature = $"{ this.ReturnType } { this.Name }({ this.ParmsSignature });"; }
public SlidingTab(IBase baseObject, IGeneratorConfiguration generatorConfiguration) : base(baseObject, generatorConfiguration) { var navigationAttribute = baseObject.GetFacetAttribute <UINavigationAttribute>(); var hasComponentAttribute = baseObject.HasFacetAttribute <UIAttribute>(); var tabName = baseObject.GetDisplayName(); string name; if (!hasComponentAttribute && baseObject.Kind == DefinitionKind.ComplexSetProperty) { var parentBase = (IParentBase)baseObject; var childElement = parentBase.ChildElements.Single(); name = childElement.GetNavigationName() + "Page"; } else { name = baseObject.GetNavigationName() + "Page"; } this.Root = name; this.Title = tabName; }