Files
fission-src/environments/dotnet/Function.cs
T
Klavs Madsen 760e021141 Added basic logging, just a facade for now
Added FissionContext class
Changed name on both class and function for input code to avoid namespace clashes when adding FissionContext
Updated README
Added section on how to develop/debug the code to README, might be obvious for some but not all
Changed code input from static function to method
2017-01-22 15:45:08 +01:00

29 lines
853 B
C#

using System;
using System.Reflection;
using Fission.DotNetCore.Api;
namespace Fission.DotNetCore.Compiler
{
class Function
{
private readonly Assembly _assembly;
private readonly Type _type;
private readonly MethodInfo _info;
public Function(Assembly assembly, Type type, MethodInfo info)
{
if (info == null) throw new ArgumentNullException(nameof(info));
if (assembly == null) throw new ArgumentNullException(nameof(assembly));
if (type == null) throw new ArgumentNullException(nameof(type));
_assembly = assembly;
_type = type;
_info = info;
}
public object Invoke(FissionContext context)
{
return _info.Invoke(_assembly.CreateInstance(_type.FullName), new[] { context });
}
}
}