Skip to content

Releases: Invenietis/yodii-script

Support for native function and namespaces.

22 Jul 15:53
Compare
Choose a tag to compare

This release extends GlobalContext to support:

  • Registration of any delegate.
  • Registration of objects can be done in "namespace"
var c = new GlobalContext();
Func<string, string> func = s => "N'" + s.Replace( "'", "''" ) + "'";
c.Register( "SqlHelper.ToSqlNString", func );
Assert.That( ScriptEngine.Evaluate( @" 'hop = ' + SqlHelper.ToSqlNString( ""Aujourd'hui"" )", c ).ToString(),
                         Is.EqualTo( "hop = N'Aujourd''hui'" ) );