In Orleans when to use IGrainFactory vs IClusterClient

Viewed 792

This is a Orleans application in a co-hosted model (ASP.NET - Web API and Orleans). I am able to inject IGrainFactory or IClusterClient into a webapi controller. Both seem to get the work fine.

I want to understand, when to use IGrainFactory and when to use IClusterClient?

1 Answers

IClusterClient is meant to be used from the client which is accessing the silo cluster. In your case, it is the webapi controller. IGrainFactory is used in a service class within a silo to get an instance of a Grain.

Maybe the article below can shed some light. https://github.com/dotnet/orleans/issues/988

Related