Exemplo n.º 1
0
        public void InvokeSendMethod(NotifyInvoke notifyInvoke)
        {
            var service    = notifyInvoke.Service;
            var method     = notifyInvoke.Method;
            var tenant     = notifyInvoke.Tenant;
            var parameters = notifyInvoke.Parameters;

            var serviceType = Type.GetType(service, true);

            using var scope = ServiceProvider.CreateScope();

            var instance = scope.ServiceProvider.GetService(serviceType);

            if (instance == null)
            {
                throw new Exception("Service instance not found.");
            }

            var methodInfo = serviceType.GetMethod(method);

            if (methodInfo == null)
            {
                throw new Exception("Method not found.");
            }

            var scopeClass = scope.ServiceProvider.GetService <NotifyServiceScope>();

            var(tenantManager, tenantWhiteLabelSettingsHelper, settingsManager) = scopeClass;
            tenantManager.SetCurrentTenant(tenant);
            tenantWhiteLabelSettingsHelper.Apply(settingsManager.Load <TenantWhiteLabelSettings>(), tenant);
            methodInfo.Invoke(instance, parameters.ToArray());
        }
Exemplo n.º 2
0
        private void SendStorageEncryptionNotification(string method, int tenantId)
        {
            var notifyInvoke = new NotifyInvoke()
            {
                Service = NotifyService,
                Method  = method,
                Tenant  = tenantId
            };

            notifyInvoke.Parameters.Add(ServerRootPath);
            try
            {
                NotifyServiceClient.InvokeSendMethod(notifyInvoke);
            }
            catch (Exception error)
            {
                Log.Warn("Error while sending notification", error);
            }
        }
Exemplo n.º 3
0
 public void InvokeSendMethod(NotifyInvoke notifyInvoke)
 {
     NotifyInvoke.Publish(notifyInvoke, CacheNotifyAction.InsertOrUpdate);
 }