SignalR Static Collection

I read some documentation about using a in memory store for a SignalR app.

http://www.asp.net/signalr/overview/guide-to-the-api/mapping-users-to- connections#inmemory

I believe you can use a Static Collection to hold your objects you need to process within the hub. Is it possible to have access to this Static collection from outside the hub? If you have other objects within the app who need access to this in memory store what is the best practise?

Answers


Best practice is to let the Hub act only as a Hub, no business logic of any kind. Also dont call the hub client methods from your core logic classes, this is highly coupled and is bad practice. Abstract the Hub either with your own code or use a library, I have created this abstraction library that is based on the Event aggregation pattern.

http://andersmalmgren.com/2014/05/27/client-server-event-aggregation-with-signalr/


Just make the Static collection public and access it like any other Static collections. The collection will be lost when the app closes so would need to be stored persisted somewhere is needed.


Need Your Help

Silent Installation in wpf

c# wpf

It is work correctly but, it's asking Do you allow following program from an unknow publisher to make changes to this computer. Yes or No I don't want this directly when i click on install button i...

Responsive web pages - designing for height

javascript html css responsive-design raphael

My apologies in advance if this question sounds more like looking for opinions or discussion.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.