I'm not using your default ui generation. I'm using a razor page (Index.cshtml) with a razor component inside that
<app>
<component type="typeof(CountryManager)" render-mode="ServerPrerendered" />
</app>
it was running fine if I inherited from CrudAppService but now I'm getting disposal is that way as well. this may have happened because I just upgraded to RC4 (which I hoped might fix the issue)
Would you like a project to test?
Thank you for your response. I actually just switched to that. I'd rather be able to call it separately, but this will work.
my goal was to get a List<ValidationResult>. but I'm hoping the following will work instead
var exceptions = new List<Exception>();
var isIdUnique = await IsCodeUnique(dto.Id, dto.Code);
if (!isIdUnique)
{
exceptions.Add(new UserFriendlyException("Country Code already exists"));
}
var isNameUnique = await IsNameUnique(dto.Id, dto.Name);
if (!isNameUnique)
{
exceptions.Add(new UserFriendlyException("Country Name already exists"));
}
if (exceptions.Any())
{
throw new AggregateException(exceptions);
}
I don't want to have to duplicate every base crud like create below just to do validation. There's got to be a better way. Please advise.
public virtual async Task<TGetOutputDto> CreateAsync(TCreateInput input)
{
await CheckCreatePolicyAsync();
*** VALIDATE***
var entity = await MapToEntityAsync(input);
TryToSetTenantId(entity);
await Repository.InsertAsync(entity, autoSave: true);
return await MapToGetOutputDtoAsync(entity);
}
I find that hard to believe that the only methods you can call our the base CRUD. Certainly you should be able to add a permission and be able to call a custom method in the Application Service.
Without this flexibility, that means having repetitive code many many times. I want to use the base CRUD but validate. This should be very very basic.
I reverted back to my original implementation which does the validation in the application service. However I still need my second question answered because I have the same issue.
when calling the service from the web project I can successfully use Service.UpdateAsync but Service.ValidateAsync needs permissions. How do I configure a proper permission?
Switching
public class CountryAppService : ApplicationService, ICountryAppService
to
public class CountryAppService : CrudAppService<Country,CountryDto, string, GetCountriesInput, CountryCreateDto, CountryUpdateDto>, ICountryAppService
resolved the issue
. .sending linkk with code to shiwei.liang@volosoft.com
I have a project for you to review this. Please provide an email address .
please ignore. I had another "virgin" module that work. At the comparisons between the two, made some changes now this is working (I think this module was based off of a non-commercial template)