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

Implement an AutoFactory library #4

Open
Carl-Hugo opened this issue Apr 24, 2020 · 0 comments
Open

Implement an AutoFactory library #4

Carl-Hugo opened this issue Apr 24, 2020 · 0 comments

Comments

@Carl-Hugo
Copy link
Member

Carl-Hugo commented Apr 24, 2020

The goal of this library is to generate factories automatically, based on an interface.
For example, the idea would be to implement the following interface automatically.

public interface IFactory
{
    IService CreateService();
}

The initial implementation would be a simple service locator, that gets IService from the container. The design may change along the way to support more complex scenarios.

Registration of factory interfaces should be simple, like:

services.AddSingleton<IService, Implementation>(); // Register the services
services.AddFactory<IFactory>(); // Register the factory

Design notes:

  • Generating "code" at compile-time could be a good way of implementing this
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