Example #1
0
    public TGrainInterface GetGrain <TGrainInterface>(string primaryKey, string grainClassNamePrefix = null)
        where TGrainInterface : IGrainWithStringKey
    {
        if (typeof(TGrainInterface) != typeof(IInventoryGrain))
        {
            throw new ApplicationException();
        }

        if (Grain is not null)
        {
            return((TGrainInterface)Grain);
        }

        Grain = _serviceProvider.GetRequiredService <FakeInventoryGrain>();

        return((TGrainInterface)Grain);
    }
Example #2
0
 public RecommendationController(Lazy <IClusterClient> client)
 {
     Client         = client;
     InventoryGrain = this.Client.Value.GetGrain <IInventoryGrain>(InventoryGrainId);
 }