I have a request, created a validator for this request, and registered it
...........................
container.RegisterValidator(typeof(DocumentPushValidator));
...........................
[Authenticate]
[Route("/DocumentPush")]
public class DocumentPush {
public string DockId { get; set; }
public WhDocumentTypes Type { get; set; }
public WhDocumet Documet { get; set; }
}
public class DocumentPushValidator : AbstractValidator<DocumentPush> {
public DocumentPushValidator() {
RuleFor(r => r.Type).NotEmpty();
RuleFor(r => r.Documet).NotNull();
}
}
everything works fine!
but…
when I add the type of the return value, then the validator does not work
public class DocumentPushResponse {
public string DockId { get; set; }
}
[Authenticate]
[Route("/DocumentPush")]
public class DocumentPush : IReturn<DocumentPushResponse> {
public string DockId { get; set; }
public WhDocumentTypes Type { get; set; }
public WhDocumet Documet { get; set; }
}
public class DocumentPushValidator : AbstractValidator<DocumentPush> {
public DocumentPushValidator() {
RuleFor(r => r.Type).NotEmpty();
RuleFor(r => r.Documet).NotNull();
}
}
but with this kind of return type everything works:
public class IsOkResponce {
public bool IsOk { get; set; }
}
Project info:
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
<PackageReference Include="MongoDB.Driver" Version="2.5.1" />
<PackageReference Include="ServiceStack" Version="5.1.0" />
<PackageReference Include="ServiceStack.Client.Core" Version="5.1.0" />
<PackageReference Include="ServiceStack.Core" Version="5.1.0" />
<PackageReference Include="ServiceStack.Redis.Core" Version="5.1.0" />
<PackageReference Include="ServiceStack.Text.Core" Version="5.1.0" />
Could you help me figure this out?
Thanks in advance.