using Microsoft.EntityFrameworkCore;
using System;
using System.Runtime.Serialization;
namespace ScrumTaskboard
{
///
/// Provides access to the database via the Entity Framework Core.
///
///
/// Each property represents a table.
/// Tables can be queried and updated via the context class.
///
public class TaskContext : DbContext
{
public DbSet Tasks { get; set; }
public DbSet Userstories { get; set; }
public DbSet Categories { get; set; }
public DbSet Sprints { get; set; }
public DbSet Status { get; set; }
public DbSet Projects { get; set; }
public DbSet Users { get; set; }
///
/// Creates a new instance with default options.
///
public TaskContext() { }
///
/// Creates a new instance with the given options.
///
public TaskContext(DbContextOptions options) : base(options) { }
}
///
/// Represents a task in an agile work process.
///
///
/// A task is a small piece of work, associated with a larger userstory.
///
public class ScrumTask
{
public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public int? StatusId { get; set; }
public ScrumStatus Status { get; set; }
public int? AssignedToId { get; set; }
public ScrumUser AssignedTo { get; set; }
public int? ProjectId { get; set; }
public ScrumProject Project { get; set; }
public int? UserstoryId { get; set; }
public ScrumUserstory Userstory { get; set; }
public ScrumPrio Priority { get; set; }
}
///
/// Represents a userstory in an agile work process.
///
///
/// A userstory is a piece of work that can be done in one sprint.
/// It can be further divided into multiple tasks.
///
public class ScrumUserstory
{
public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public ScrumPrio Priority { get; set; }
public int? StatusId { get; set; }
public ScrumStatus Status { get; set; }
public int? CategoryId { get; set; }
public ScrumCategory Category { get; set; }
public int? CreatedById { get; set; }
public ScrumUser CreatedBy { get; set; }
public int? ProjectId { get; set; }
public ScrumProject Project { get; set; }
public int? SprintId { get; set; }
public ScrumSprint Sprint { get; set; }
}
///
/// Represents a category of userstories.
///
///
/// Every userstory can optionally be associated with a single category.
/// This can be helpful to organize work in larger teams.
///
public class ScrumCategory
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Color { get; set; }
public int? ProjectId { get; set; }
public ScrumProject Project { get; set; }
}
///
/// Represents an agile sprint.
///
///
/// A sprint is typically one to four weeks long.
/// Userstories are typically started and completed
/// during one sprint.
///
public class ScrumSprint
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public int? ProjectId { get; set; }
public ScrumProject Project { get; set; }
}
///
/// Represents the status of a task or userstory.
///
///
/// Classic status are "Backlog", "In Progress" and "Done", but
/// teams can create others to fit their individual workflow.
///
public class ScrumStatus
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
///
/// Represents a project that the team works on.
///
///
/// Userstories and sprints can be categorized into projects,
/// to help organization for larger teams.
///
public class ScrumProject
{
public int Id { get; set; }
public string Title { get; set; }
public bool IsPrivate { get; set; }
}
///
/// Represents a team member that can work on userstories.
///
///
/// This allows teams to track who is working on a userstory
/// at a given time.
///
public class ScrumUser
{
public int Id { get; set; }
public string Name { get; set; }
}
public enum ScrumPrio
{
[EnumMember(Value = "low")]
Low,
[EnumMember(Value = "medium")]
Medium,
[EnumMember(Value = "high")]
High
}
}