This project is read-only.

Issues with MacroService

Jan 19, 2012 at 9:07 AM

Something's changed since latest versions?

For a custom macro I used to register with this statement:

macros.Register(typeof(CustomMacro));

I've just updated the library via NuGet and now this statement doesn't work anymore.

Following the example, I don't see any way to register a custom macro. This "today" macro:

        private string _macroSampleText1 = @"Local news for $[today format=""MM//dd//yyyy""/] with NY Times.";

that is supposed to be the custom macro "SimpleDateMacro" isn't registered anywhere.

So I've supposed that the MacroService can find it somehow from the current assemply. But it just doesn't work: I get a "The given key was not present in the dictionary."

This is my current (not working) code:

public static string DoShortCode(string sourceString)
{
var macros = new MacroService();
macros.Load("CommonLibrary");
return macros.BuildContent(sourceString);
}

The old code that used to work:

public static string DoShortCode(string sourceString)
{
var macros = new MacroService();
macros.Load("CommonLibrary");
macros.Register(typeof(Stars));
return macros.BuildContent(sourceString);
}

Probably I'm missing something...

Coordinator
Jan 21, 2012 at 3:59 AM

hi,

I haven't built a nuget module for commonlibrary.net.

Try using the latest stable version from the downloads ( 0.9.7 ) or take the 0.9.8 beta ( current ).

Looks like the unit-tests are working so i'm not sure what's wrong w/ your code.

See if the unit-tests or examples are working and if not... please post again and i'll try answering:

sample: 

http://commonlibrarynet.codeplex.com/SourceControl/changeset/view/71149#1190527

unit-tests:

http://commonlibrarynet.codeplex.com/SourceControl/changeset/view/71149#1180316

- kishore