Added automatic relation mapping

This commit is contained in:
2025-01-16 15:30:52 +01:00
parent 9d9f0ef7e4
commit c3c69466d4
9 changed files with 71 additions and 41 deletions

View File

@@ -23,8 +23,7 @@ builder.Services.AddHopFrame(options => {
options.AddDbContext<DatabaseContext>(context => {
context.Table<User>(table => {
table.Property(u => u.Password)
.List(false)
.DisplayValue(false);
.ValueParser(pwd => pwd + "-edited");
table.Property(u => u.FirstName)
.SetDisplayName("First Name");
@@ -35,6 +34,8 @@ builder.Services.AddHopFrame(options => {
table.Property(u => u.Id)
.Sortable(false)
.ValueTemplate(Guid.CreateVersion7);
table.SetDisplayName("Benutzer");
});
context.Table<Post>()
@@ -46,8 +47,8 @@ builder.Services.AddHopFrame(options => {
.SetDisplayName("ID");
context.Table<Post>()
.Property(p => p.Author)
.IsRelation(true);
.Property(p => p.CreatedAt)
.ValueTemplate(() => DateTime.UtcNow);
});
});