Skip to content

Better handling of property injection #210

@Keboo

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions