Ajout des noms des tables via les annotations de données

pull/29/head
Clement CHIEU 1 year ago
parent 6e11809f60
commit ff1b907c80

@ -1,14 +1,11 @@
using System; using System.ComponentModel.DataAnnotations;
using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Entities namespace Entities;
[Table("BlackList")]
public class BlackListEntity
{ {
public class BlackListEntity
{
[Key] [Key]
public string Email { get; set; } public string Email { get; set; }
public DateOnly ExpirationDate { get; set; } public DateOnly ExpirationDate { get; set; }
@ -18,5 +15,4 @@ namespace Entities
Email = email; Email = email;
ExpirationDate = expirationDate; ExpirationDate = expirationDate;
} }
}
} }

@ -1,9 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Entities namespace Entities;
[Table("ContentLesson")]
public class ContentLessonEntity
{ {
public class ContentLessonEntity
{
[ForeignKey(nameof(Lesson))] [ForeignKey(nameof(Lesson))]
public int LessonId { get; set; } public int LessonId { get; set; }
public LessonEntity Lesson { get; set; } public LessonEntity Lesson { get; set; }
@ -20,5 +21,4 @@ namespace Entities
LessonPartId = lessonPartId; LessonPartId = lessonPartId;
Paragraph = paragraph; Paragraph = paragraph;
} }
}
} }

@ -1,4 +1,6 @@
namespace Entities using System.ComponentModel.DataAnnotations;
namespace Entities
{ {
public class InquiryEntity public class InquiryEntity
{ {

@ -1,10 +1,11 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Entities namespace Entities;
[Table("InquiryTable")]
public class InquiryTableEntity
{ {
public class InquiryTableEntity
{
[Key] [Key]
[ForeignKey(nameof(Owner))] [ForeignKey(nameof(Owner))]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@ -33,5 +34,4 @@ namespace Entities
DatabaseName = databaseName; DatabaseName = databaseName;
ConnectionInfo = connectionInfo; ConnectionInfo = connectionInfo;
} }
}
} }

@ -1,7 +1,10 @@
namespace Entities using System.ComponentModel.DataAnnotations.Schema;
namespace Entities;
[Table("Lesson")]
public class LessonEntity
{ {
public class LessonEntity
{
public int Id { get; set; } public int Id { get; set; }
public string? Title { get; set; } public string? Title { get; set; }
public string? LastPublisher { get; set; } public string? LastPublisher { get; set; }
@ -27,5 +30,4 @@
LastPublisher = lastPublisher; LastPublisher = lastPublisher;
LastEdit = lastEdit; LastEdit = lastEdit;
} }
}
} }

@ -1,9 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Entities namespace Entities;
[Table("Notepad")]
public class NotepadEntity
{ {
public class NotepadEntity
{
public int Id { get; set; } public int Id { get; set; }
[ForeignKey(nameof(User))] [ForeignKey(nameof(User))]
@ -34,5 +35,4 @@ namespace Entities
Inquiry = inquiry; Inquiry = inquiry;
Notes = notes; Notes = notes;
} }
}
} }

@ -1,7 +1,10 @@
namespace Entities using System.ComponentModel.DataAnnotations.Schema;
namespace Entities;
[Table("Paragraph")]
public class ParagraphEntity
{ {
public class ParagraphEntity
{
public int Id { get; set; } public int Id { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Content { get; set; } public string Content { get; set; }
@ -34,5 +37,4 @@
Query = query; Query = query;
Comment = comment; Comment = comment;
} }
}
} }

@ -1,10 +1,11 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Entities namespace Entities;
[Table("Solution")]
public class SolutionEntity
{ {
public class SolutionEntity
{
[Key] [Key]
[ForeignKey(nameof(Owner))] [ForeignKey(nameof(Owner))]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@ -40,5 +41,4 @@ namespace Entities
MurderWeapon = murderWeapon; MurderWeapon = murderWeapon;
Explanation = explanation; Explanation = explanation;
} }
}
} }

@ -1,9 +1,10 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Entities namespace Entities;
[Table("Success")]
public class SuccessEntity
{ {
public class SuccessEntity
{
[ForeignKey(nameof(User))] [ForeignKey(nameof(User))]
public int UserId { get; set; } public int UserId { get; set; }
public UserEntity User { get; set; } public UserEntity User { get; set; }
@ -37,5 +38,4 @@ namespace Entities
Inquiry = inquiry; Inquiry = inquiry;
IsFinished = isFinished; IsFinished = isFinished;
} }
}
} }

@ -1,17 +1,19 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Entities namespace Entities;
[Table("User")]
public class UserEntity
{ {
[Table("user")]
public class UserEntity
{
public int Id { get; set; } public int Id { get; set; }
public string Username { get; set; } public string Username { get; set; }
public string Password { get; set; } public string Password { get; set; }
public string Email { get; set; } public string Email { get; set; }
public bool IsAdmin { get; set; } public bool IsAdmin { get; set; }
public UserEntity() { } public UserEntity()
{
}
public UserEntity(int id) public UserEntity(int id)
{ {
@ -34,5 +36,4 @@ namespace Entities
Email = email; Email = email;
IsAdmin = isAdmin; IsAdmin = isAdmin;
} }
}
} }
Loading…
Cancel
Save