Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-6894

CreateContainer, ConfigureContainer - inconsistency

    XMLWordPrintable

Details

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      Inother Bootstrappers (Mef, Unity), CreateContainer is called first, than ConfigureContainer,
      this is the logical order of things developers used to.
      AutofacBootstrapper is doing it the other way around, which is confusing at first and need to dig in AutofacBoostrapper source code to understand.
      (Although it's logical for Autofac, as ContainerBuilder is created first)

      In addition it's not simple at all to perform some logic after Container is created,
      For example, if it's required to create Multitenant container during the Boorstrapper execution
      ie.

      #!C#
      new MultitenantContainer(renantIdentificationStrategy, **base.Container**);
      

      It cannot be done in ConfigureContainer (Which logically developers would assume is the place)
      nor in CreateContainer, since the Base.Build is not available in derive Boostrapper
      ie.

      #!C#
      protected override IContainer CreateContainer()
      {
         var container = base.Builder.Build();
         _multitenant = new MultitenantContainer(_tenantIdentificationStrategy, container);
         return 
      }
      

      currently only ugly workarounds work, like storing in a field the ContainerBuilder we got in ConfigureContainer and later in CreateContainer, use it to create the Container and the MultitenantContainer

      It would be nice to simplify developers' experience for cases Container is required
      thanks

      Attachments

        Activity

          People

            Unassigned Unassigned
            Anonymous Anonymous
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: