Access to settingsService from signalr hub

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hello,

i have a plugin which implement a signalr hub.

actually i have no access to the settingsService instance of the plugin.
i implement a connectionString parameter in the settings of the plugin.

which is the right way to access the settings from within the code of the hub.


using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using EsiMobile.Data;
using EsiMobile.Data.Querys;
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
using Nop.Web.Framework.Controllers;

namespace Nop.Plugin.Misc.EsiMobile.Hubs
{

    //https://stackoverflow.com/questions/46904678/call-signalr-core-hub-method-from-controller

    public class EsiMobileHub : Hub
    {

        public override Task OnConnectedAsync()
        {
            var id = Context.ConnectionId;
            var name = Context.User.Identity.Name;

            return base.OnConnectedAsync();
        }

...

}

Regards
Alex
5 years ago
I found a solution but don't know if its the right way ?

public DataServiceSiData()
{
     DBHost = EngineContext.Current.Resolve<EsiMobileSettings>().ConnectionString;
}
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.