-
-
Notifications
You must be signed in to change notification settings - Fork 158
Closed
Labels
Description
We should be able to reflect on the assembly and auto discover all implementations of IIdentifiable<,>, IResourceService<,>, IEntityRepository<,> adding them to the ContextGraph. A possible API might look like:
public void ConfigureServices(IServiceCollection services)
{
services.AddJsonApi(options =>
options.BuildContextGraph((builder) =>
builder.AddAssembly(/*...*/);
);
);
}We may also expose the following for finer control:
builder.AddAssemblyResources(/* ... */); // should also register ResourceDefinitions
builder.AddAssemblyServices(/* ... */);
builder.AddAssemblyRepositories(/* ... */);This work may include improved handling for multiple database contexts. See #269. In order to automatically handle multiple contexts, we need a way to specify that FooRepository depends on BarDbContextResolver at startup. Currently, I don't think Microsoft's DI library provides anything with that level of registration. We could consider providing a separate package that depends on Autofac (for example) where we explicitly construct the dependency graph.
bugproof, milosloub and joshhubers