예제 #1
0
        public void RegisterExport(MethodBase methodBase, bool bindToInstance, string script)
        {
            var ei = new ExportInfo {
                MethodBase = methodBase, Script = script
            };

            if (bindToInstance)
            {
                var ti = FindTypeInfo(methodBase.DeclaringType);
                if (ti == null)
                {
                    throw new InvalidOperationException("no type info for exported instance's type");
                }
                if (ti.InstanceExports == null)
                {
                    ti.InstanceExports = new List <ExportInfo>();
                }
                ti.InstanceExports.Add(ei);
            }
            else
            {
                staticExports.Add(ei);
                InteropContextManager.WithAllRuntimes
                    (runtime => runtime.BindExportedMethod(methodBase, null, script));
            }
        }
예제 #2
0
 public InteropContext(Runtime runtime)
 {
     InteropContextManager.PushRuntime(runtime);
 }
예제 #3
0
 public void Dispose()
 {
     InteropContextManager.PopRuntime();
     GC.SuppressFinalize(this);
 }