vmware-archive / runtimes

Kubeless function runtimes: https://kubeless.io/docs/runtimes/
Apache License 2.0
81 stars 89 forks source link

C# / .NET features #100

Open AlbertoDePena opened 4 years ago

AlbertoDePena commented 4 years ago

I just came across this project. Looks so awesome!

A few questions:

  1. Does it support dependency injection (ILogger, repositories, etc) and if so how does it register those dependencies?
  2. Does it support a static class/method (thinking about functions for F#)?

Thanks in advance =)

andresmgot commented 4 years ago

cc/ @allantargino @lorenzo-ange

edokan commented 4 years ago

I'm not an authority here but, as far as I read the code

  1. No, it does not. It uses reflection to load your compiled assembly and to create your class. No DI system, but it should not be runtime's concern, since in theory your code must work all by itself.
  2. No, it does not. It creates an instance using Activator.CreateInstance, finds your method with GetMethod, and invokes it using Invoke using previously created instance.

https://github.com/kubeless/runtimes/blob/13e5cf5d6d7a6bb8a6aa82ea2aebeed384f3d85f/stable/dotnetcore/src/Kubeless.Core/Invokers/CompiledFunctionInvoker.cs#L19-L32