Skip to content

Accept methods returning Task #3

@jnyrup

Description

@jnyrup

Validation.Integration.WCF naturally does not support async methods decorated with [OperationContract].

This blog post describes the path to add support for async Begin/End pattern.
https://philippetruche.wordpress.com/2008/07/14/using-the-enterprise-library-validation-block-with-wcf-asynchronous-operations/

Adding support async methods returning Task or Task<T> is similar.
In addition to checking on operation.SyncMethod it should also check operation.TaskMethod.

I've been using that check for ~2 years now with net472 projects, but we want to migrate to .netstandard projects and possibly avoid maintaining my own fork of Validation.Integration.WCF.

E.g.

ValidationBehavior.HasValidationAssertions(OperationDescription operation)
{
    MethodInfo methodInfo = operation.SyncMethod ?? operation.Task;
    ...
}

public ValidationParameterInspector(OperationDescription operation, string ruleSet)
{
    MethodInfo method = operation.SyncMethod ?? operation.Task;
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions