Skip to content

Instantly share code, notes, and snippets.

@dnasca
Created April 11, 2015 08:16
Show Gist options
  • Select an option

  • Save dnasca/abec09c44d414fbcd2a9 to your computer and use it in GitHub Desktop.

Select an option

Save dnasca/abec09c44d414fbcd2a9 to your computer and use it in GitHub Desktop.
Creating a Data layer - 1b.) Data Model Classes - Every Note can have a Reply
/*
The second step in creating the data model class will be modeling the Reply.
Each reply will have it's own Id, a body, created date, and a property that will point Entity to creating a foriegn key (TopicId)
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Notes.Data
{
public class Reply
{
public int Id { get; set; }
public string Body { get; set; }
public DateTime Created { get; set; }
//The way to get back to the topic that owns it.
public int TopicId { get; set; } // Entity will see the Id and the name of another type, and create a foreign key index
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment