question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Callbacks for container creation

See original GitHub issue

Last one for tonight, I promise 😉

would

OnHostContainerCreated   (Action<IServiceProvider>          callback)
OnTenantContainerCreated (Action<TTenant, IServiceProvider> callback)
OnRequestContainerCreated(Action<TTenant, IServiceProvider> callback)

callbacks be something that you would consider pulling into Dotnettency?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
dazinatorcommented, Nov 20, 2017

I am finishing this feature up now.

registration API looks like this:

                       containerBuilder.WithStructureMap((tenant, tenantServices) =>
                       {
                           tenantServices.AddSingleton<SomeTenantService>((sp) =>
                           {    
                               return new SomeTenantService(tenant, sp.GetRequiredService<IHostingEnvironment>());
                           });                         
                       })
                      .TenantContainerEvents((events) =>
                       {
                           // callback invoked after tenant container is created.
                           events.OnTenantContainerCreated(async (tenantResolver, tenantServiceProvider) =>
                           {
                               var tenant = await tenantResolver;

                           })
                           // callback invoked after a nested container is created for a tenant. i.e typically during a request.
                           .OnNestedTenantContainerCreated(async (tenantResolver, tenantServiceProvider) =>
                           {
                               var tenant = await tenantResolver;

                           });
                       })

0reactions
dazinatorcommented, Nov 20, 2017

Hmm another slight changed. Moved the API around a bit. You now register like this:


                  .ConfigureTenantContainers((containerBuilder) =>
                   {                 
                       containerBuilder.Events((events) =>
                       {
                           // callback invoked after tenant container is created.
                           events.OnTenantContainerCreated(async (tenantResolver, tenantServiceProvider) =>
                           {
                               var tenant = await tenantResolver;

                           })
                           // callback invoked after a nested container is created for a tenant. i.e typically during a request.
                           .OnNestedTenantContainerCreated(async (tenantResolver, tenantServiceProvider) =>
                           {
                               var tenant = await tenantResolver;

                           });
                       })
                       .WithStructureMap((tenant, tenantServices) =>
                       {

Read more comments on GitHub >

github_iconTop Results From Across the Web

Container Callbacks, for the special moments in a bean's ...
The SessionBean interface declares four container callback methods for giving the bean its bean context, activating it, passivating it, and removing it. We'll ......
Read more >
Containers used in the callback interface
The callback interface provides mandatory and optional containers as input to the registered program to create or manage a resource of a ...
Read more >
4.5 Customizing the nature of a bean
The Spring Framework provides several callback interfaces to change the behavior of your bean in the container; they include InitializingBean and ...
Read more >
EJB - Callbacks
EJB 3.0 specification has specified callbacks for which callback handler methods are created. EJB Container calls these callbacks. We can define callback ......
Read more >
CONTAINERCALLBACK | Callback Functions
A void pointer that can be used to access a variable or structure containing data that the callback function needs. This makes it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found