/// <summary>
 /// Initializes a new instance of the <see cref="ConstructorResolver"/> class for the given factory
 /// and instantiation strategy.
 /// </summary>
 /// <param name="objectFactory">The object factory to work with.</param>
 /// <param name="autowireFactory">The object factory as IAutowireCapableObjectFactory.</param>
 /// <param name="instantiationStrategy">The instantiation strategy for creating objects.</param>
 /// <param name="valueResolver">the resolver to resolve property value placeholders if any</param>
 public ConstructorResolver(AbstractObjectFactory objectFactory, IAutowireCapableObjectFactory autowireFactory,
                            IInstantiationStrategy instantiationStrategy, ObjectDefinitionValueResolver valueResolver)
 {
     this.objectFactory = objectFactory;
     this.autowireFactory = autowireFactory;
     this.instantiationStrategy = instantiationStrategy;
     this.valueResolver = valueResolver;
 }
コード例 #2
0
 public void _Setup()
 {
     ObjectFactory = new DefaultListableObjectFactory(true);
     invocationLog.Clear();
     _parentCounter = 0;
     _childCounter = 0;
 }
コード例 #3
0
        public void _SetUp()
        {
            ObjectFactory = CreateObjectFactory(true);

            GenericObjectDefinition threadCreatorInsideConstructor = new GenericObjectDefinition();
            threadCreatorInsideConstructor.ObjectTypeName = typeof(ThreadCreatorInsideConstructor).FullName;
            threadCreatorInsideConstructor.IsSingleton = true;
            ObjectFactory.RegisterObjectDefinition("threadCreatorInsideConstructor", threadCreatorInsideConstructor);

            GenericObjectDefinition threadCreatorInsideDispose = new GenericObjectDefinition();
            threadCreatorInsideDispose.ObjectTypeName = typeof(ThreadCreatorInsideDispose).FullName;
            threadCreatorInsideDispose.IsSingleton = true;
            ObjectFactory.RegisterObjectDefinition("threadCreatorInsideDispose", threadCreatorInsideDispose);
        }
コード例 #4
0
        public void GetObjectIsThreadSafe()
        {
            ObjectFactory = CreateObjectFactory(true);

            GenericObjectDefinition theSpouse = new GenericObjectDefinition();
            theSpouse.ObjectTypeName = typeof(TestObject).FullName;
            theSpouse.IsSingleton = false;
            ObjectFactory.RegisterObjectDefinition("theSpouse", theSpouse);

            GenericObjectDefinition theObject = new GenericObjectDefinition();
            theObject.ObjectTypeName = typeof(TestObject).FullName;
            theObject.IsSingleton = false;
            theObject.PropertyValues.Add("Spouse", theSpouse);
            ObjectFactory.RegisterObjectDefinition("theObject", theObject);

            AsyncTestTask t1 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();
            AsyncTestTask t2 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();
            AsyncTestTask t3 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();
            AsyncTestTask t4 = new AsyncTestMethod(20000, new ThreadStart(GetTheTestObject)).Start();

            t1.AssertNoException();
            t2.AssertNoException();
            t3.AssertNoException();
            t4.AssertNoException();
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectDefinitionValueResolver"/> class.
        /// </summary>
        /// <param name="objectFactory">The object factory.</param>
        public ObjectDefinitionValueResolver(AbstractObjectFactory objectFactory)
        {
            this.log = LogManager.GetLogger(this.GetType());

            this.objectFactory = objectFactory;
        }
コード例 #6
0
ファイル: CaoExporter.cs プロジェクト: ouyangyl/MySpringNet
			/// <summary>
			/// Create a new instance of the RemoteFactory.
			/// </summary>
            public CaoRemoteFactory(ILifetime lifetime, string targetName, 
                string[] interfaces, AbstractObjectFactory objectFactory)
			{
				this.targetName = targetName;
				this.objectFactory = objectFactory;

                this.remoteObjectFactory = new RemoteObjectFactory();
                this.remoteObjectFactory.BaseType = typeof(BaseCao);
                this.remoteObjectFactory.Interfaces = interfaces;
                this.remoteObjectFactory.Infinite = lifetime.Infinite;
                this.remoteObjectFactory.InitialLeaseTime = lifetime.InitialLeaseTime;
                this.remoteObjectFactory.RenewOnCallTime = lifetime.RenewOnCallTime;
                this.remoteObjectFactory.SponsorshipTimeout = lifetime.SponsorshipTimeout;
			}