public static void AddReferenceAndImportNamespaces(this IScriptExecutor executor, Type[] types)
        {
            Guard.AgainstNullArgument("executor", executor);

            executor.AddReferences(types);
            executor.ImportNamespaces(types);
        }
Beispiel #2
0
        public static void ImportNamespaces(this IScriptExecutor executor, params Type[] typesFromReferencedAssembly)
        {
            Guard.AgainstNullArgument("typesFromReferencedAssembly", typesFromReferencedAssembly);
            var namespaces = typesFromReferencedAssembly.Select(t => t.Namespace);

            executor.ImportNamespaces(namespaces.ToArray());
        }
Beispiel #3
0
        public ScriptResult Execute(string script)
        {
            _exec.AddReferences(typeof(Percentage));
            _exec.AddReferenceAndImportNamespaces(new [] { typeof(PackageBuilder), GetType(), typeof(RequiredAttribute) });
            _exec.ImportNamespaces("System.Linq", "CavemanTools");

            _exec.Initialize(new string[0], new IScriptPack[0]);
            return(_exec.ExecuteScript(GetScriptContent(script)));
        }
 public static void AddReferenceAndImportNamespaces(this IScriptExecutor executor, Type[] types)
 {
     executor.AddReferences(types);
     executor.ImportNamespaces(types);
 }
 public static void ImportNamespace <T>(this IScriptExecutor executor)
 {
     executor.ImportNamespaces(typeof(T));
 }
        public static void ImportNamespace <T>(this IScriptExecutor executor)
        {
            Guard.AgainstNullArgument("executor", executor);

            executor.ImportNamespaces(typeof(T));
        }