Book Image

SignalR Blueprints

By : Einar Ingerbrigsten
Book Image

SignalR Blueprints

By: Einar Ingerbrigsten

Overview of this book

Table of Contents (18 chapters)
SignalR Blueprints
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
9
Debugging or Troubleshooting
Index

Creating the models


At the heart of the news domain sits an article. This domain will be a simple one for us, even simpler than the forum we created in Chapter 2, Overheating the Discussion. This is the only domain-specific model we will need.

Let's create a folder called News inside the Models folder and put a class called Article inside it (right-click on the News folder, select Class from Add, and name it Article). Make the new class look like the following code:

using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Chapter3.Models.News
{
    public class Article
    {
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ID { get; set; }
        public string ImageUrl { get; set; }
        public string Headline { get; set; }
        public string Byline { get; set; }
        public string Lead { get; set; }
        public string Body { get; set; }
        public DateTime PublishedDate { get; set; }
        public string PublishedBy { get...