예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StructureMapAspectContainer"/> class.
        /// </summary>
        public StructureMapAspectContainer(IContainer container)
        {
            Proxy = new MasterProxy {Container = new StructureMapServiceLocator(container)};

            _interceptor = new StructureMapDefinedAspectInterceptor(container);
            // Use "Configure", not "Initialize."  Initialize overwrites existing settings
            container.Configure(c =>
            {
                c.RegisterInterceptor(_interceptor);
                c.For<IMasterProxy>().Use(Proxy);
            });
        }
예제 #2
0
        //private IContainer _container;
        /// <summary>
        /// Initializes a new instance of the <see cref="StructureMapAspectContainer"/> class.
        /// </summary>
        public StructureMapAspectContainer()
        {
            Proxy = new MasterProxy();

            _interceptor = new StructureMapDefinedAspectInterceptor(ObjectFactory.Container);
            // Use "Configure", not "Initialize."  Initialize overwrites existing settings.

            ObjectFactory.Configure(c =>
            {
                c.RegisterInterceptor(_interceptor);
                c.For<IMasterProxy>().Use(Proxy);
            });
        }