Skip to content

Better handling of property injection #210

Description

@Keboo

Consider the following

public class Foo
{
    [Dependency]
    public IService Service { get; set; }
}

It would be nice if this were weaved to be the equivalent of:

public class Foo
{
    private IService C<>_service;
    [Dependency]
    public IService Service 
    {
        get => C<>_service ?? GlobalDI.GetService<IService>();
        set => C<>_service = value;
    }
}

This would allow unit tests an opportunity to inject a test double without interfering with AutoDI functionality.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions