Started working on editor dialog
This commit is contained in:
@@ -9,6 +9,8 @@ public class DatabaseContext(DbContextOptions<DatabaseContext> options) : DbCont
|
||||
|
||||
public DbSet<Post> Posts { get; set; }
|
||||
|
||||
public DbSet<Typer> Typers { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder) {
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
@@ -22,5 +24,8 @@ public class DatabaseContext(DbContextOptions<DatabaseContext> options) : DbCont
|
||||
.HasMany(u => u.Posts)
|
||||
.WithOne(p => p.Sender)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<Typer>()
|
||||
.HasKey(t => t.Id);
|
||||
}
|
||||
}
|
||||
23
debug/TestApplication/Models/Typer.cs
Normal file
23
debug/TestApplication/Models/Typer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace TestApplication.Models;
|
||||
|
||||
public class Typer {
|
||||
[Key]
|
||||
public Guid Id { get; set; }
|
||||
public int Number { get; set; }
|
||||
public bool Toggle { get; set; }
|
||||
public DateTime DateTime { get; set; }
|
||||
public DateOnly DateOnly { get; set; }
|
||||
public TimeOnly TimeOnly { get; set; }
|
||||
public ListSortDirection SortDirection { get; set; }
|
||||
public string? Text { get; set; }
|
||||
[EmailAddress]
|
||||
public string? Mail { get; set; }
|
||||
public string? LongText { get; set; }
|
||||
public string? Password { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
public List<string> List { get; set; } = new();
|
||||
public List<ListSortDirection> SortDirections { get; set; } = new();
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using HopFrame.Core.Configuration;
|
||||
using HopFrame.Core.EFCore;
|
||||
using HopFrame.Web;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -30,6 +31,17 @@ builder.Services.AddHopFrame(config => {
|
||||
config.Table<Post>(table => {
|
||||
table.SetDescription("The posts dataset. It contains all posts sent via the application.");
|
||||
});
|
||||
|
||||
config.Table<Typer>(table => {
|
||||
table.Property(t => t.LongText)
|
||||
.SetType(PropertyType.TextArea);
|
||||
|
||||
table.Property(t => t.Password)
|
||||
.SetType(PropertyType.Password);
|
||||
|
||||
table.Property(t => t.PhoneNumber)
|
||||
.SetType(PropertyType.PhoneNumber);
|
||||
});
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
Reference in New Issue
Block a user