public override Task OnActivateAsync()
 {
     if (_logger == null)
     {
         _logger = OrleansLoggerSingleton.Logger;
     }
     return(TaskDone.Done);
 }
        public override async Task OnActivateAsync()
        {
            _correlationId = this.GetPrimaryKey();
            _logger        = OrleansLoggerSingleton.Logger;

            _logger.Information(string.Format("CommandResponseGrain [{0}]>> Grain Activated", _correlationId));
            await TaskDone.Done;
        }
        public static void LogAndThrownInvalidOp(string message, IOrleansLog logger)
        {
            var exception = new InvalidOperationException(message);

            if (logger != null)
            {
                logger.Error(exception);
            }
            throw exception;
        }
        public async override Task OnActivateAsync()
        {
            if (_logger == null)
            {
                _logger = OrleansLoggerSingleton.Logger;
            }

            if (!State.IsInitialized)
            {
                if (State.DeviceMappings == null)
                {
                    State.DeviceMappings = new ConcurrentDictionary <string, string>();
                }

                State.DeviceObserverManager = new ObserverSubscriptionManager <IDeviceObserver>();
                State.IsInitialized         = true;
            }

            await WriteStateAsync();

            var reminderName = string.Format("{0}", "keepalive");

            await RegisterOrUpdateReminder(reminderName, new TimeSpan(0, 10, 0), new TimeSpan(0, 10, 0));
        }