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

Add missing constructors to DependencyOverride<T> #195

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

Add missing constructors to DependencyOverride<T> #195

ENikS opened this issue Jun 2, 2020 · 0 comments
Assignees
Labels
Enhancement 🔨 Improvement of existing features
Milestone

Comments

@ENikS
Copy link
Contributor

ENikS commented Jun 2, 2020

Description

DependencyOverride<T> does not implement a constructor that would take a name parameter.

Problem

The DependencyOverride<T> class declared with only one constructor that takes value of the override.

    public class DependencyOverride<T> : DependencyOverride
    {
        public DependencyOverride(object dependencyValue)
            : base(null, typeof(T), null, dependencyValue)
        {
        }
    }

In case override should target a named dependency, a constructor with name argument is required.

Solution

Add additional constructors to cover missing functionality:

        public DependencyOverride<T>(Type target, string name, object value)
            : base(target, typeof(T), name, value)
        {
        }

        public DependencyOverride<T>(string name, object value)
            : base(null, typeof(T), name, value)
        {
        }

Impact

None.

@ENikS ENikS self-assigned this Jun 2, 2020
@ENikS ENikS changed the title DependencyOverride<T> does not have a constructor with name Add missing constructors to DependencyOverride<T> Jun 3, 2020
@ENikS ENikS transferred this issue from unitycontainer/abstractions Sep 26, 2020
@ENikS ENikS transferred this issue from unitycontainer/container Jun 27, 2021
@ENikS ENikS added the Enhancement 🔨 Improvement of existing features label Jun 27, 2021
@ENikS ENikS added the 5.12.0 label Jun 27, 2021
@ENikS ENikS removed the 5.12.0 label Mar 10, 2023
ENikS added a commit that referenced this issue Mar 16, 2023
@ENikS ENikS added this to the 6.0.0 milestone Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 🔨 Improvement of existing features
Projects
None yet
Development

No branches or pull requests

1 participant