Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying SignalR Blueprints
  • Table Of Contents Toc
SignalR Blueprints

SignalR Blueprints

By : Einar Ingerbrigsten
close
close
SignalR Blueprints

SignalR Blueprints

By: Einar Ingerbrigsten

Overview of this book

This book is designed for software developers, primarily those with knowledge of C#, .NET, and JavaScript. Good knowledge and understanding of SignalR is assumed to allow efficient programming of core elements and applications in SignalR.
Table of Contents (12 chapters)
close
close
9
9. Debugging or Troubleshooting
11
Index

The magic code

Now we've got the basics of the layout done and we are ready to get some code in here for lighting it all up. Let's start by creating the hub for the article management. Add a folder called Hubs in the root of the project, and then create a new class called ArticleHub in this folder. Add the following code in the new class:

using System;
using System.Collections.Generic;
using Chapter3.DAL;
using Chapter3.Models.News;
using Microsoft.AspNet.SignalR;

namespace Chapter3.Hubs
{
    public class ArticleHub : Hub
    {
        ArticleContext _articleContext;
        public ArticleHub()
        {
            _articleContext = new ArticleContext();
        }

  protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
               _articleContext.Dispose();
            }
            base.Dispose(disposing);
        }

        public IEnumerable<Article> GetArticles()
        {
            return _articleContext.GetArticles...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
SignalR Blueprints
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon