I really don't like doing this validation in the DTO, but I was unable to get it to work any other way. It would be great if the second half of your validation page (https://docs.abp.io/en/abp/latest/Validation) had more detail and specific usage on an alternative method.
Regardless, I'm dealing with a few issues with this approach:
Thanks
public class CountryCreateDto : IValidatableObject
{
private string _id;
private string _name;
[Required]
[StringLength(CountryConsts.IdMaxLength, MinimumLength = CountryConsts.IdMinLength)]
[RegularExpression(@"^[A-Z''-'\s]{2,3}$", ErrorMessage = "The Country Code must be between two and three uppercase letters.")]
[DisplayName("Code")]
public string Id
{
get => _id;
set => _id = value.Trim()
.ToUpper();
}
[Required]
[StringLength(CountryConsts.NameMaxLength, MinimumLength = CountryConsts.NameMinLength)]
public string Name
{
get => _name;
set => _name = value.Trim().ToUpper();
}
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var service = validationContext.GetRequiredService<ICountryAppService>();
var validationResults = new List<ValidationResult>();
var isIdUnique = Task.Run(async () => await service.IsIdUnique(Id))
.Result;
if (!isIdUnique)
{
validationResults.Add(new ValidationResult("Country Code already exists", new[]
{
"Id"
}));
}
var isNameUnique = Task.Run(async () => await service.IsNameUnique( Name))
.Result;
if (!isNameUnique)
{
validationResults.Add(new ValidationResult("Country Name already exists", new[]
{
"Name"
}));
}
return validationResults;
}
}
I am having all sorts of trouble with this error. Sometimes it works once, sometimes not at all
This is coming from an ABP Suite generated ApplicationService
public class CountryAppService : ApplicationService, ICountryAppService
This is being utilized by a Blazor component hosted in a razor file
<app>
<component type="typeof(CountryManager)" render-mode="ServerPrerendered" />
</app>
I had no problems whatsoever with v3.
Let me know if you require additional information. Thank you
I do realize that there is information on how to integrate the Kendo components, however this is not working for me, at least not well enough. Due to legacy code, it is not practical to utilize the defer method, so I'm removing jQuery.js and moving it higher in the head. This worked in previous versions and works now except I end up with two separate jQuery.js resources and this is causing trouble.
These errors are the main culprits:
How do I get rid of that second JavaScript file or keep it from loading in the first place. I don't know where it's coming from. I'm assuming consolidating to a single jQuery.js resource will resolve my issues.
I have used this for months with version <= 3.3.1 with Abp.AspNetCore.Mvc.UI.Theme.AdminLTE and it works perfectly. However with the commercial version 3.3.1 & 4.0RC it does not
Thank you!