Beispiel #1
0
        void LoadInitializer(XmlElement element)
        {
            XmlElement initializerElement = element.SelectSingleNode("initializer") as XmlElement;

            if (null != initializerElement)
            {
                _initializer = (IObjectInitializer)InitializerHelper.LoadInitializer(initializerElement);
            }
        }
Beispiel #2
0
 public Pool(int size, IObjectCreator <T> objectCreator, IObjectInitializer <T> initializer = null)
 {
     if (objectCreator == null)
     {
         throw new ArgumentNullException("objectCreator", "ObjectCreate should have a value");
     }
     creator          = objectCreator;
     this.initializer = initializer;
     items            = new T[size];
 }
        public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
        {
            _context.EnterObject(obj, info);

            Type        type    = obj.GetType();
            TypeMapping mapping = _context.GetTypeMapping(type);

            IObjectInitializer initializer = mapping.Initializer;

            if (null != initializer)
            {
                initializer.InitializeObject(_context);
            }
            else
            {
                DefaultObjectInitializer.Default.InitializeObject(_context);
            }

            _context.LeaveObject();

            return(null);
        }
		void LoadInitializer(XmlElement element)
		{
			XmlElement initializerElement = element.SelectSingleNode("initializer") as XmlElement;
			if (null != initializerElement)
			{
				_initializer = (IObjectInitializer)InitializerHelper.LoadInitializer(initializerElement);
			}
		}