Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » New API : Where are these methods ?

New API : Where are these methods ?

Gaëtan
Reply

Hi,

I've managed to more or less find my way in the new api when upgrading my solution, but I can't seem to find an equivalent for these methods from the old API :

  • Dynamicweb.Rendering.Template.SetTags(IDataReader values)
  • Dynamicweb.LogToFile.Log()

Where can I get that ?

 

Thanks !


Replies

 
Nicolai Pedersen
Reply

Hi Gaëtan

The SetTags method was deprecated since the internal use of it has been obsoluted due to the fact we do not want to uncritically add data to the tag collection of the object and it would not keep naming. So if you still want to use it, you can add an extension method to your project with the code.

It looks like this:

public void SetTags(IDataReader values)
{
	int x = 0;

	while (x <= values.FieldCount - 1) {
		if (this.Type == TemplateType.Razor) {
			SetRawTag(values.GetName(x), values.Item(x));
		} else {
			SetTag(values.GetName(x), Base.ChkString(values.Item(x)));
		}
		x += 1;
	}
}

LogToFile has been replaced by Dynamicweb.Logging package

You can access it like this:

using Dynamicweb.Logging.ILogger logger = Dynamicweb.Logging.LogManager.Current.GetLogger("YouFeatureName"){
	logger.Error("some");
	logger.Debug("other");
	logger.Log("Etc...");
}

BR Nicolai

 
Gaëtan
Reply

Ok thanks. What is the parameter for the GetLogger ? Is it the folder name (same as LogToFile) ?

 
Nicolai Pedersen
Reply

Hi Gaëtan

In LogToFile it was a path.

The new API always logs into the /Files/System/Log folder - the name you specify in GetLogger will be a subfolder in here.

 

You must be logged in to post in the forum