Purpose of FormattedEventLogTraceListenerAssembler

Topics: Building and extending application blocks, Enterprise Library Core
Aug 9, 2007 at 6:50 AM
Edited Aug 9, 2007 at 7:54 AM
Hello!

Can any one tell me the difference between the following lines of code.

Assembler(typeof(FormattedEventLogTraceListenerAssembler))
public class FormattedEventLogTraceListenerData : TraceListenerData { }

or without Assembler Attribute
public class FormattedEventLogTraceListenerData : TraceListenerData { }

I have created a custom configuration section within System Configuration file and access it without any problem. The code is as follows:
namespace DataFiles
{
public class DataFilesSettings : SerializableConfigurationSection { ... }
public class FileData : NameTypeConfigurationElement { ... }
public class FileDataCollection : PolymorphicConfigurationElementCollection<FileData> { ... }
}

and Section in XML is like this

<configuration>
<configSections>
<section name="dataFilesConfiguration" type="DataFiles.DataFilesSettings, DataFiles" />
</configSections>

<dataFilesConfiguration>
<dataFiles>
<add fileIndex="3" fileDataType="DataFiles.FileData, DataFiles" name ="Price" type = "" />
</dataFiles>
</dataFilesConfiguration>
</configuration>

why there is two attributes in dataFilesConfiguration/dataFiles/add->type and fileDataType
or
incase of TraceListener
listenerDataType and type in loggingConfiguration/listeners/add

Thanks
Zeeshan Gulzar
Aug 9, 2007 at 12:51 PM

Hi,

The attribute is not using during configuration deserialization; the object factories use them to determine how to create a provider from a configuration object.


why there is two attributes in dataFilesConfiguration/dataFiles/add->type and fileDataType
or
incase of TraceListener
listenerDataType and type in loggingConfiguration/listeners/add

I'm not sure what you need to know. The configuration objects for almost all "polymorphic" providers are deserialized based on the provider type (using the ConfigurationElementType attribute). But since existing trace listeners may not have the attribute, configuration object types for trace listeners do require the extra listenerDataType to be identified.

Regards,
Fernando