Skip to content

Grain Constructors

The abstract base class for all grain classes.

Grain

View source
protected Grain()
This constructor should never be invoked. We expose it so that client code (subclasses of Grain) do not have to add a constructor. Client code should use the GrainFactory property to get a reference to a Grain.

Grain(IGrainContext, IGrainRuntime?)

View source
protected Grain(IGrainContext grainContext, IGrainRuntime? grainRuntime = null)
Grain implementers do NOT have to expose this constructor but can choose to do so. This constructor is particularly useful for unit testing where test code can create a Grain and replace the IGrainIdentity and IGrainRuntime with test doubles (mocks/stubs).

Parameters

grainContextIGrainContext
grainRuntimeIGrainRuntime?