Added automatic relation mapping
This commit is contained in:
@@ -16,13 +16,13 @@ public class Post {
|
||||
[ForeignKey("author")]
|
||||
public User? Author { get; set; }
|
||||
|
||||
/*public bool Published { get; set; }
|
||||
public bool Published { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
public DateOnly Created { get; set; }
|
||||
|
||||
public TimeOnly At { get; set; }*/
|
||||
public TimeOnly At { get; set; }
|
||||
|
||||
public ListSortDirection Type { get; set; }
|
||||
}
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user