I am trying to add a custom property that is a guide, but it gives me this error:
System.InvalidCastException: Failed to convert parameter value from string to manual. ---> System.InvalidCastException: invalid cast from 'System.String' to 'System.Guid'.
I indicate this in config:
<parameter> <parameterName value="@id" /> <dbType value="Guid" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%X{id}" /> </layout> </parameter>
The actual code (snippet) I'm using 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 uniqueidentifier NOT NULL, but it does not have a primary key.
Per hornshรธj-schierbeck
source share