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

Replace IEquatable<> with IMatch<> #43

Open
ENikS opened this issue Jun 14, 2020 · 0 comments
Open

Replace IEquatable<> with IMatch<> #43

ENikS opened this issue Jun 14, 2020 · 0 comments
Assignees

Comments

@ENikS
Copy link
Contributor

ENikS commented Jun 14, 2020

Description

Unity Abstractions relies on IEquatable<> to determine compatibility of dependencies with various injected members.

Problem

IEquatable<T> interface implements one method: bool Equals(T? other)
The other parameter is passed as nullable, so before it is used, it needs to be checked for null. Every call to this method adds a null check although it is never null.

Solution

To resolve this issue IEquatable<T> interface should be replaced with custom interface:

    public interface IMatch<T>
    {
        public bool Match(T other);
    }

Impact

Custom Injection Members will require refactoring.

@ENikS ENikS self-assigned this Jun 14, 2020
@ENikS ENikS changed the title Replace IEquatable<> with ICompatible<> Replace IEquatable<> with IMatch<> Jun 14, 2020
ENikS referenced this issue in unitycontainer/abstractions Jun 14, 2020
ENikS referenced this issue in unitycontainer/container Jun 14, 2020
Fixed unitycontainer/abstractions#178
ENikS referenced this issue in unitycontainer/interception Jun 14, 2020
Fixed unitycontainer/abstractions#178
ENikS referenced this issue in unitycontainer/unity Jun 14, 2020
Fixed unitycontainer/abstractions#178
@ENikS ENikS transferred this issue from unitycontainer/abstractions Sep 26, 2020
@ENikS ENikS transferred this issue from unitycontainer/container Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant