Stacker
Stacker

Reputation: 8237

serializing NLog LogLevel Datatype through a WCF Web Service

I have a wcf WebService with a method which takes LogLevel type (part of Nlog) as a parameter, the LogLevel is build in type comes with a framework for logging called NLog, Problem is WCF doesnt know how to marshal the loglevel parameter i guess cause its not decorated with DataContract.

is there is any way i can marshal LogLevel through the webservice ?

Note im trying not to wrap it in a custom class.

Upvotes: 1

Views: 424

Answers (2)

springy76
springy76

Reputation: 3786

You can't transport the entire LogLevel instance. But you can use the string name instead. Call your method with the property value loglevelInstance.Name and recreate a LogLevel instance at the server side using LogLevel.FromName(theString).

Upvotes: 2

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65441

It is could by due to the LogLevel being an enum. Convert it to a text, send it over and then convert it back on the client side.

Upvotes: 1

Related Questions