Added ef core integration
This commit is contained in:
13
debug/TestApplication/Models/Post.cs
Normal file
13
debug/TestApplication/Models/Post.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TestApplication.Models;
|
||||
|
||||
public class Post {
|
||||
[Key]
|
||||
public Guid Id { get; } = Guid.CreateVersion7();
|
||||
|
||||
public required User Sender { get; set; }
|
||||
|
||||
[MaxLength(5000)]
|
||||
public required string Message { get; set; }
|
||||
}
|
||||
30
debug/TestApplication/Models/User.cs
Normal file
30
debug/TestApplication/Models/User.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TestApplication.Models;
|
||||
|
||||
public class User {
|
||||
[Key]
|
||||
public Guid Id { get; } = Guid.CreateVersion7();
|
||||
|
||||
[EmailAddress, MaxLength(25)]
|
||||
public required string Email { get; set; }
|
||||
|
||||
[MaxLength(25)]
|
||||
public required string Username { get; set; }
|
||||
|
||||
[MaxLength(64)]
|
||||
public required string Password { get; set; }
|
||||
|
||||
[MaxLength(25)]
|
||||
public required string FirstName { get; set; }
|
||||
|
||||
[MaxLength(25)]
|
||||
public required string LastName { get; set; }
|
||||
|
||||
[MaxLength(255)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public required DateOnly Birth { get; set; } = DateOnly.FromDateTime(DateTime.Today);
|
||||
|
||||
public List<Post> Posts { get; set; } = new();
|
||||
}
|
||||
Reference in New Issue
Block a user