Skip to content

Add missing constructors to DependencyOverride<T> #195

Open
@ENikS

Description

@ENikS

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.

Metadata

Metadata

Assignees

Labels

Enhancement 🔨Improvement of existing features

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions