Added policy validation, ordering and virtual listing properties

This commit is contained in:
2025-01-16 20:23:28 +01:00
parent 4908947217
commit e9f686cf19
17 changed files with 321 additions and 93 deletions

View File

@@ -3,7 +3,7 @@ using System.Reflection;
namespace HopFrame.Core.Config;
public class PropertyConfig(PropertyInfo info, TableConfig table) {
public class PropertyConfig(PropertyInfo info, TableConfig table, int nthProperty) {
public PropertyInfo Info { get; } = info;
public TableConfig Table { get; } = table;
public string Name { get; set; } = info.Name;
@@ -19,6 +19,8 @@ public class PropertyConfig(PropertyInfo info, TableConfig table) {
public bool DisplayValue { get; set; } = true;
public bool IsRelation { get; set; }
public bool IsRequired { get; set; }
public bool IsListingProperty { get; set; }
public int Order { get; set; } = nthProperty;
}
public class PropertyConfig<TProp>(PropertyConfig config) {
@@ -84,4 +86,9 @@ public class PropertyConfig<TProp>(PropertyConfig config) {
InnerConfig.Validator = obj => validator.Invoke((TProp?)obj);
return this;
}
public PropertyConfig<TProp> OrderIndex(int index) {
InnerConfig.Order = index;
return this;
}
}