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

Support IEnumerable dependencies #72

Open
MGRussell opened this issue Nov 19, 2021 · 0 comments
Open

Support IEnumerable dependencies #72

MGRussell opened this issue Nov 19, 2021 · 0 comments

Comments

@MGRussell
Copy link

MGRussell commented Nov 19, 2021

IEnumerables in constructor injection (and I assume, but have not tested, property injection) are currently not being initialized and left as null. They should be resolved by Locator.Current.GetServices().

Here is a helper method workaround in the meantime.

public static void ResolveIEnumerable<T>(ref IEnumerable<T> target)
{
    // https://github.com/reactivemarbles/Splat.DI.SourceGenerator/issues/72
    if (target != null)
    {
        throw new InvalidOperationException("This issue has been resolved. Remove this method.");
    }

    target = Locator.Current.GetServices<T>();
}
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