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

Dependency Injection/Auto-wiring #4

Open
mrousavy opened this issue Jun 28, 2018 · 1 comment
Open

Dependency Injection/Auto-wiring #4

mrousavy opened this issue Jun 28, 2018 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mrousavy
Copy link
Owner

Implement Dependency Injection for interfaces or other properties.

Example:

class LoginModel : Model
{
    [Autowired]
    IDatabase Database { get; }
}

Jellyfish should automatically find the IDatabase implementation (or it is pre-configured before initialization), and initialize the Database { get; } property with that instance. The IDatabase instance is either already initialized somewhere (👍) or initialized by the default constructor (👎)

Example 2:

class LoginModel : Model
{
    IDatabase Database { get; }

    public LoginModel(IDatabase database)
    {
        Database = database;
    }
}
@mrousavy mrousavy added enhancement New feature or request help wanted Extra attention is needed labels Jun 28, 2018
@mrousavy
Copy link
Owner Author

Created IInjector, InjectionExtensions, InjectionResolver, Injector ~@ 26fdaa0

Done

  • Register via templated initializer functions
  • Register via auto type/constructor resolving
  • Register via static singleton instances
  • Remove bindings
  • Initialize Instances via Initialize()
  • Auto-Inject fields and properties of a given type

To Do

  • [Autowired] attribute
  • Auto-constructor injection

See Dependency Injection 📖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant