Skip to content

Do not require constructor/function parameters with default values to be resolvable while creating an object #103

@octia

Description

@octia

I'm moving from Zenject to Reflex. I have a constructor like this:
public StorageManager(string customStoragePath = null)
{
// My stuff
}

Currently when I'm attempting to create my StorageManager, it complains
"Cannot resolve contract 'System.String' while instantiating object type StorageManager"
even though there is a default value provided.

The obvious solution would be to use a factory, but I also have other systems within which there is a mix of injected and default values, and it'd make my installers really messy - right now, I have a very clean system where I just list the types, and it binds them all in the way I want using the default constructors, and switching to factories would mean that my entire init system needs a complete rework.

Would it be a big problem to allow parameters with default values to not need resolving? Perhaps as an option in Reflex settings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions