ValidationContext.GetService(Type) Método

Definição

Retorna o serviço que fornece a validação personalizada.Returns the service that provides custom validation.

public:
 virtual System::Object ^ GetService(Type ^ serviceType);
public object GetService (Type serviceType);
public object? GetService (Type serviceType);
abstract member GetService : Type -> obj
override this.GetService : Type -> obj
Public Function GetService (serviceType As Type) As Object

Parâmetros

serviceType
Type

O tipo do serviço a ser usado para validação.The type of the service to use for validation.

Retornos

Object

Uma instância do serviço ou null, se o serviço não estiver disponível.An instance of the service, or null if the service is not available.

Implementações

Comentários

Se o ServiceContainer objeto for definido no nível do aplicativo, o GetService método o acessará para recuperar o serviço solicitado.If the ServiceContainer object is defined at the application level, the GetService method accesses it to retrieve the requested service.

Se o ServiceContainer objeto não for definido ou não retornar o serviço, o GetService método consultará o IServiceProvider objeto que é passado para o ValidationContext método para obter o serviço.If the ServiceContainer object is not defined or it does not return the service, the GetService method queries the IServiceProvider object that is passed to the ValidationContext method in order to obtain the service.

Aplica-se a

Confira também