Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine PolicyWrap configuration syntax to take parameters as interfaces #297

Closed
reisenberger opened this issue Aug 18, 2017 · 1 comment
Closed

Comments

@reisenberger
Copy link
Member

reisenberger commented Aug 18, 2017

The current PolicyWrap configuration syntax in PolicyWrapSyntax.cs and PolicyWrapSyntaxAsync.cs pre-dates the introduction of interfaces: the parameters are the concrete classes Policy or Policy<TResult>.

Typing the parameters instead from the interfaces:

  • ISyncPolicy
  • ISyncPolicy<TResult>
  • IAsyncPolicy
  • IAsyncPolicy<TResult>

would:

  • offer more precision (it wouldn't be possible to wrap a sync with an async policy, which would lead to a runtime error) (EDIT: tho the changes proposed in Cleanly formalise the separation of sync and async policies (was: option to unify them) #281 may make this superfluous)
  • offer more flexibility - wraps could (in principle) use custom user ISyncPolicy implementations
  • [EDITed to add] allow users to wrap policies where they had chosen to express the policies to be wrapped (when they defined them earlier), as interfaces. At the moment this is not possible, because the syntax only accepts the concrete classes.
@reisenberger reisenberger changed the title Refine PolicyWrap configuration syntax to take parameters is interfaces Refine PolicyWrap configuration syntax to take parameters as interfaces Aug 19, 2017
@reisenberger reisenberger added this to the v5.6.0 milestone Nov 24, 2017
@reisenberger
Copy link
Member Author

This is delivered in Polly v5.6.0 (will be released via nuget in next day or so).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant