Esempio n. 1
0
        // Create a ViralSharedInjectionContext to build the instance, no matter what kind of InjectionContext the current context is
        public TCurrent BuildAndShareInstance <TCurrent>(InjectionProcess <TCurrent> process, ObjectDescription description, ParameterSet parameters)
        {
            var myContext = new ViralSharedInjectionContext <TCurrent>(this, description, parameters);

            process.Execute(myContext);
            return(myContext.Instance);
        }
        internal override void DoBuildInstance(ISharingLifetimeScope scope, ParameterSet parameters, out T instance)
        {
            var context = new ViralSharedInjectionContext <T>(scope, _description, parameters);

            _process.Execute(context);
            instance = context.Instance;
            // replace the ObjectBuilder
            InjectionOperatorHelper.UpgradeToNonSharedObjectBuilder
                (_builder, new NonSharedInjectionOperator <T>(_builder, _description, _lifetime, _process));
        }