Skip to content
This repository was archived by the owner on Nov 2, 2018. It is now read-only.
This repository was archived by the owner on Nov 2, 2018. It is now read-only.

Consider lifting requirement to register open generic types by type #450

Closed

Description

@khellang

When working on decoration in Scrutor, I noticed that there's an exception being thrown if you try to register an open generic type using a factory function.

What's the reasoning behind this? Is it just an oversight?

They way I've implemented the decoration is by chaining together ServiceDescriptors using a combination of factory functions and ActivatorUtilities, but by having this limitation in place, I can't register a factory function for open generics.

It would be nice if this requirement was lifted 😄

Activity

  1. khellang commented on Sep 9, 2016

    @khellang
    ContributorAuthor

    Actually, after doing this work myself and digging a bit deeper, I realized this won't work anyway, cause there's no way to know the actual type being requested in a factory function.

    That means I can't get the generic arguments of the concrete service type being requested 😞

    I don't see a way this can be solved, without changing the signature of the factory delegate to include more information...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions