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); }
public RecommendationController(Lazy <IClusterClient> client) { Client = client; InventoryGrain = this.Client.Value.GetGrain <IInventoryGrain>(InventoryGrainId); }