Closed knepe closed 5 years ago
What version of dotnettency packages are you using at present?
Unfortunately the API at the moment only lets you configure the child container for tenants via the IServiceCollection abstraction, and the root container is also created for you and populated with your applications IServiceCollection, and there is no hook offered for you to pass in an existing root container or to configure it via its native API's.
This came up once before here https://github.com/dazinator/Dotnettency/issues/27
It is sonething I'd like to add in the future.
Also in the interests of transparency, I have found some failing test cases when using structuremap, specifically when attempting to AddMvc at a per tenant level rather than application level. I was able to get this scenario to work with autofac, but not structuremap. For this reason I have personally switched to autofac now as my backing container of choice.
RE: your sample, things have changed a bit on the develop branch, its probably worth taking a look at the sample there (or over in the dotnettency.samples repo - aspnet core 2 branch)
Thank you for the response :) I actually got it working by adding all my generic services on the IServiceCollection (had to use Scrutor to Scan etc). But works good. Would it be much work to support to pass an already created container in the IServiceCollection abstraction instead of creating a new one?
Glad to hear you made progress! I don't think it would be too much work to allow passing in an existing root container.. i'll leave this open to track this.
I am going to close this, because I am deciding to deprecate structuremap in favour of lamar. There have been issues with structuremap that prevent stuff working with child containers correctly, and the feedback when these were raised: https://github.com/structuremap/structuremap/issues/618 was basically that structuremap is no longer actively supported, and to switch to lamar. This makes it a bad choice for me to use moving forwards.
Hi, So, I'm trying to migrate to this from SaasKit because this seems more what I want. I have followed the samples for StructureMap and TenantContainers, but I end up with an error:
No default Instance is registered and cannot be automatically determined for type 'ITenantContainerBuilder<AppTenant>'
AppTenant
is my tenant class and I have this in Startup: https://gist.github.com/knepe/1bd885d1764b533356c7c133022e39a4Any clue of what I'm doing wrong? I want to use StructureMap for the "generic services" as I use stuff like Scan and Decorate