Skip to content

Implement an AutoFactory library #4

Open
@Carl-Hugo

Description

@Carl-Hugo

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

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