Created
April 7, 2013 02:24
-
-
Save jrusbatch/5328614 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Execute(string code, IEnumerable<string> references, IEnumerable<string> namespaces, ScriptPackSession scriptPackSession) | |
{ | |
var host = _scriptHostFactory.CreateScriptHost(new ScriptPackManager(scriptPackSession.Contexts)); | |
foreach (var context in scriptPackSession.Contexts) _scriptEngine.AddReference(context.GetType().Assembly); | |
var session = _scriptEngine.CreateSession(host); | |
foreach (var reference in references.Union(scriptPackSession.References).Distinct()) | |
session.AddReference(reference); | |
foreach (var @namespace in namespaces.Union(scriptPackSession.Namespaces).Distinct()) | |
session.ImportNamespace(@namespace); | |
Execute(code, session); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment