I'm trying to add a custom property which is a guid, but it gives me this error:
System.InvalidCastException: Failed to convert parameter value from a String to a Guid. ---> System.InvalidCastException: Invalid cast from 'System.String' to 'System.Guid'.
I specify this in the config:
<parameter>
<parameterName value="@id" />
<dbType value="Guid" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%X{id}" />
</layout>
</parameter>
The actual code (snippet) i use is this:
Guid guid = Guid.NewGuid();
if (defaultLogger.IsEnabledFor(level))
{
var loggingEvent = new LoggingEvent(ThisDeclaringType,
defaultLogger.Repository, defaultLogger.Name, level, message, exception);
loggingEvent.Properties["Id"] = guid;
Any help please? :) The id field in the database is defined as a uniqueidentifier NOT NULL, but it does not have the primary key contraint.