This class aggregates several PropertiesDictionary collections together.

Provides a dictionary style lookup over an ordered list of PropertiesDictionary collections.

		/// <summary>
		/// Write the property value to the output
		/// </summary>
		/// <param name="writer"><see cref="TextWriter" /> that will receive the formatted result.</param>
		/// <param name="state">null, state is not set</param>
		/// <remarks>
		/// <para>
		/// Writes out the value of a named property. The property name
		/// should be set in the <see cref="log4net.Util.PatternConverter.Option"/>
		/// property.
		/// </para>
		/// <para>
		/// If the <see cref="log4net.Util.PatternConverter.Option"/> is set to <c>null</c>
		/// then all the properties are written as key value pairs.
		/// </para>
		/// </remarks>
		override protected void Convert(TextWriter writer, object state) 
		{
			CompositeProperties compositeProperties = new CompositeProperties();

#if !NETCF
			PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
			if (logicalThreadProperties != null)
			{
				compositeProperties.Add(logicalThreadProperties);
			}
#endif
			PropertiesDictionary threadProperties = ThreadContext.Properties.GetProperties(false);
			if (threadProperties != null)
			{
				compositeProperties.Add(threadProperties);
			}

			// TODO: Add Repository Properties
			compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties());

			if (Option != null)
			{
				// Write the value for the specified key
				WriteObject(writer, null, compositeProperties[Option]);
			}
			else
			{
				// Write all the key value pairs
				WriteDictionary(writer, null, compositeProperties.Flatten());
			}
		}
Example #2
0
		private void CreateCompositeProperties()
		{
			m_compositeProperties = new CompositeProperties();

			if (m_eventProperties != null)
			{
				m_compositeProperties.Add(m_eventProperties);
			}
#if !NETCF
			PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
			if (logicalThreadProperties != null)
			{
				m_compositeProperties.Add(logicalThreadProperties);
			}
#endif
			PropertiesDictionary threadProperties = ThreadContext.Properties.GetProperties(false);
			if (threadProperties != null)
			{
				m_compositeProperties.Add(threadProperties);
			}

			// TODO: Add Repository Properties

			m_compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties());
		}
Example #3
0
        void CreateCompositeProperties()
        {
            m_compositeProperties = new CompositeProperties();

            if (m_eventProperties != null)
                m_compositeProperties.Add(m_eventProperties);

            var logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
            if (logicalThreadProperties != null)
                m_compositeProperties.Add(logicalThreadProperties);

            var threadProperties = ThreadContext.Properties.GetProperties(false);
            if (threadProperties != null)
                m_compositeProperties.Add(threadProperties);

            // TODO: Add Repository Properties

            m_compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties());
        }
Example #4
0
		private void CreateCompositeProperties()
		{
			m_compositeProperties = new CompositeProperties();

			if (m_eventProperties != null)
			{
				m_compositeProperties.Add(m_eventProperties);
			}
#if !NETCF
			PropertiesDictionary logicalThreadProperties = LogicalThreadContext.Properties.GetProperties(false);
			if (logicalThreadProperties != null)
			{
				m_compositeProperties.Add(logicalThreadProperties);
			}
#endif
			PropertiesDictionary threadProperties = ThreadContext.Properties.GetProperties(false);
			if (threadProperties != null)
			{
				m_compositeProperties.Add(threadProperties);
			}

			// TODO: Add Repository Properties

			// event properties
			PropertiesDictionary eventProperties = new PropertiesDictionary();
			eventProperties[UserNameProperty] = UserName;
			eventProperties[IdentityProperty] = Identity;
			m_compositeProperties.Add(eventProperties);

			m_compositeProperties.Add(GlobalContext.Properties.GetReadOnlyProperties());
		}