Grain Disambiguation
I am working on the project that some grain implementations inherit from an abstract grain implementation . Some just like this: public abstract class A: Grain, IGrainInterface { abstract method(); }
public class B: A { override method(); }
public class C: A { override method() }
It seems I can use a grainClassNamePrefix to solve this problem, but I haven't found any documents to describe how to use it.
Thanks!
You can pass a fully qualified class name to GetGrain() as optional parameter:
GetGrain<IGrainInterface>(key, "your-namespace.B");
GetGrain<IGrainInterface>(key, "your-namespace.C");
or just a prefix of the fully qualified name, if the grain classes are defined in different namespaces:
GetGrain<IGrainInterface>(key, "B-namespace");
GetGrain<IGrainInterface>(key, "C-namespace");
The namespace approach works well for switching between different implementations of multiple grain classes, for example, between test and production.
@sergeybykov It works. Thanks a lot!