Add() public method

Add a Properties Dictionary to this composite collection

Properties dictionaries added first take precedence over dictionaries added later.

public Add ( log4net.Util.ReadOnlyPropertiesDictionary properties ) : void
properties log4net.Util.ReadOnlyPropertiesDictionary the properties to add
return void
コード例 #1
0
		/// <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());
			}
		}
コード例 #2
0
ファイル: LoggingEvent.cs プロジェクト: aj9251/pandorasbox3
		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());
		}
コード例 #3
0
ファイル: LoggingEvent.cs プロジェクト: Vizzini/netgore
        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());
        }
コード例 #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());
		}