-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Service dependencies parameter class for RelationalConnection #7494
Conversation
public RelationalConnectionDependencies Clone( | ||
[CanBeNull] IDbContextOptions contextOptions = null, | ||
[CanBeNull] ILogger<IRelationalConnection> logger = null) | ||
=> new RelationalConnectionDependencies( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a more granular approach: WithOptions
, WithLogger
, etc.
This way we don't need to obsolete the overloads as we add more dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we strictly need to obsolete the overloads?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't obsolete them then we'll end up with redundant methods. We could avoid that altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anpete @AndriySvyryd The "With" thing is nice--we've done it before--but it can result in lost of code--as it did before! It somewhat depends how often we think this will happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndriySvyryd That depends on whether we use optional args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we use optional args, we will probably need to add new methods to avoid binary breaks. I think I'm leaning towards With methods. We shouldn't have inheritance hierarchies here, like we did with DbInterceptionContext, so the number of methods should be more manageable.
This is a proof-of-concept implementation of parameter objects for service dependencies. Issue #7465. Notes: - Parameter class is sealed. - Ended up going with With methods on the parameters object--cleaner than other things I tried, and general purpose. - Registration is back to try-add again because apparently Add results in multiple services registered in the ServiceCollection...
7b62116
to
65fcf91
Compare
@anpete @AndriySvyryd @divega Pushed a version using "With..." methods. |
Merged |
This is a proof-of-concept implementation of parameter objects for service dependencies. Issue #7465.
Notes: