Beispiel #1
0
        public static void Initialize(Action <IInitializationExpression> action)
        {
            lock (typeof(ObjectFactory))
            {
                var expression = new InitializationExpression();
                action(expression);

                PluginGraph graph = expression.BuildGraph();

                _container = new Container(graph);
                Profile    = expression.DefaultProfileName;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Fire up and initialize a new container. It is accessible through the <see cref="Container"/> property.
        /// Some convenience methods are available that route to this container. Passing no action equates to starting the container
        /// without any configuration. A subsequent call to this method will overwrite the reference that the Objectfactory held to the previous
        /// <see cref="IContainer"/> instance.
        /// </summary>
        public static void Initialize(Action <IInitializationExpression> action = null)
        {
            if (action == null)
            {
                return;
            }
            lock (_lockObject)
            {
                var expression = new InitializationExpression();
                action(expression);

                var graph     = expression.BuildGraph();
                var container = new Container(graph);
                _containerBuilder = new Lazy <Container>(() => container);
                nameContainer(container);
            }
        }