Skip to content
Snippets Groups Projects
Commit 22122b5d authored by esantangelo's avatar esantangelo
Browse files

entity configuration

parent 04a1fe14
No related branches found
No related tags found
2 merge requests!26Develop,!25Feature/communications
using System;
using System.Collections.Generic;
using System.Text;
namespace Tsi1.DataLayer.Entities
{
public class Communication
{
public int Id { get; set; }
public string Text { get; set; }
public DateTime ValidUntil { get; set; }
public Course Course { get; set; }
public Tenant Tenant { get; set; }
}
}
......@@ -11,6 +11,7 @@ namespace Tsi1.DataLayer.Entities
StudentCourses = new HashSet<StudentCourse>();
ProfessorCourses = new HashSet<ProfessorCourse>();
Sections = new HashSet<Section>();
Communications = new HashSet<Communication>();
}
public int Id { get; set; }
......@@ -22,5 +23,7 @@ namespace Tsi1.DataLayer.Entities
public ICollection<StudentCourse> StudentCourses { get; set; }
public ICollection<ProfessorCourse> ProfessorCourses { get; set; }
public ICollection<Section> Sections { get; set; }
public ICollection<Communication> Communications { get; set; }
}
}
......@@ -13,6 +13,7 @@ namespace Tsi1.DataLayer.Entities
Students = new HashSet<Student>();
Users = new HashSet<User>();
Surveys = new HashSet<Survey>();
Communications = new HashSet<Communication>();
}
public int Id { get; set; }
......@@ -24,5 +25,7 @@ namespace Tsi1.DataLayer.Entities
public ICollection<Student> Students { get; set; }
public ICollection<User> Users { get; set; }
public ICollection<Survey> Surveys { get; set; }
public ICollection<Communication> Communications { get; set; }
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
using Tsi1.DataLayer.Entities;
namespace Tsi1.DataLayer.EntityConfiguration
{
public class CommunicationConfiguration : IEntityTypeConfiguration<Communication>
{
public void Configure(EntityTypeBuilder<Communication> builder)
{
builder.HasKey(x => x.Id);
builder.Property(x => x.Text)
.IsRequired()
.HasColumnType("character varying(1000)");
builder.Property(x => x.ValidUntil)
.IsRequired();
builder.HasIndex(x => x.ValidUntil);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment