diff --git a/src/HopFrame.Web.Admin/Generators/IAdminContextGenerator.cs b/src/HopFrame.Web.Admin/Generators/IAdminContextGenerator.cs
index 49cf115..970d82c 100644
--- a/src/HopFrame.Web.Admin/Generators/IAdminContextGenerator.cs
+++ b/src/HopFrame.Web.Admin/Generators/IAdminContextGenerator.cs
@@ -2,6 +2,11 @@ namespace HopFrame.Web.Admin.Generators;
public interface IAdminContextGenerator {
+ ///
+ /// Returns the generator object for the specified Admin Page. This needs to be within the same Admin Context.
+ ///
+ /// The Model of the Admin Page
+ ///
IAdminPageGenerator Page();
}
\ No newline at end of file
diff --git a/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs b/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs
index 12591bb..2a71a75 100644
--- a/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs
+++ b/src/HopFrame.Web.Admin/Generators/IAdminPageGenerator.cs
@@ -5,24 +5,105 @@ namespace HopFrame.Web.Admin.Generators;
public interface IAdminPageGenerator {
+ ///
+ /// Sets the title of the Admin Page
+ ///
+ /// the specified title
+ ///
IAdminPageGenerator Title(string title);
+
+ ///
+ /// Sets the description of the Admin Page
+ ///
+ /// the specified description
+ ///
IAdminPageGenerator Description(string description);
+
+ ///
+ /// Sets the url for the Admin Page
+ ///
+ /// the specified url (administration/{url})
+ ///
IAdminPageGenerator Url(string url);
+ ///
+ /// Sets the permission needed to view the Admin Page
+ ///
+ /// the specified permission
+ ///
IAdminPageGenerator ViewPermission(string permission);
+
+ ///
+ /// Sets the permission needed to create a new Entry
+ ///
+ /// the specified permission
+ ///
IAdminPageGenerator CreatePermission(string permission);
+
+ ///
+ /// Sets the permission needed to update an Entry
+ ///
+ /// the specified permission
+ ///
IAdminPageGenerator UpdatePermission(string permission);
+
+ ///
+ /// Sets the permission needed to delete an Entry
+ ///
+ /// the specified permission
+ ///
IAdminPageGenerator DeletePermission(string permission);
+
+ ///
+ /// Enables or disables the create button
+ ///
+ /// the specified state
+ ///
IAdminPageGenerator ShowCreateButton(bool show);
+
+ ///
+ /// Enables or disables the delete button
+ ///
+ /// the specified state
+ ///
IAdminPageGenerator ShowDeleteButton(bool show);
+
+ ///
+ /// Enables or disables the update button
+ ///
+ /// the specified state
+ ///
IAdminPageGenerator ShowUpdateButton(bool show);
+ ///
+ /// Specifies the default sort property and direction
+ ///
+ /// Which property should be sorted
+ /// In which direction should be sorted
+ ///
IAdminPageGenerator DefaultSort(Expression> propertyExpression, ListSortDirection direction);
+ ///
+ /// Specifies the repository for the page
+ ///
+ /// The specified repository
+ ///
IAdminPageGenerator ConfigureRepository() where TRepository : ModelRepository;
+
+ ///
+ /// Returns the generator of the specified property
+ ///
+ /// The property
+ ///
IAdminPropertyGenerator Property(Expression> propertyExpression);
+
+ ///
+ /// Specifies the default property that should be displayed as a property in other listings
+ ///
+ /// The property
+ ///
IAdminPageGenerator ListingProperty(Expression> propertyExpression);
}
diff --git a/src/HopFrame.Web.Admin/Generators/IAdminPropertyGenerator.cs b/src/HopFrame.Web.Admin/Generators/IAdminPropertyGenerator.cs
index 7f138bb..4fbab5b 100644
--- a/src/HopFrame.Web.Admin/Generators/IAdminPropertyGenerator.cs
+++ b/src/HopFrame.Web.Admin/Generators/IAdminPropertyGenerator.cs
@@ -4,25 +4,120 @@ namespace HopFrame.Web.Admin.Generators;
public interface IAdminPropertyGenerator {
+ ///
+ /// Should the property be sortable or not
+ ///
+ ///
IAdminPropertyGenerator Sortable(bool sortable);
+
+ ///
+ /// Should the admin be able to edit the property after creation or not
+ ///
+ ///
IAdminPropertyGenerator Editable(bool editable);
+
+ ///
+ /// Should the value of the property be displayed while editing or not (useful for passwords and tokens)
+ ///
+ ///
IAdminPropertyGenerator DisplayValueWhileEditing(bool display);
+
+ ///
+ /// Should the property be a column on the page list or not
+ ///
+ ///
IAdminPropertyGenerator DisplayInListing(bool display = true);
+
+ ///
+ /// Should the property be ignored completely
+ ///
+ ///
IAdminPropertyGenerator Ignore(bool ignore = true);
+
+ ///
+ /// Is the value of the property database generated and is not meant to be changed
+ ///
+ ///
IAdminPropertyGenerator Generated(bool generated = true);
+
+ ///
+ /// Should the property value be bold in the listing or not
+ ///
+ ///
IAdminPropertyGenerator Bold(bool bold = true);
+
+ ///
+ /// Is the value of the property unique under all other entries in the dataset
+ ///
+ ///
+ ///
IAdminPropertyGenerator Unique(bool unique = true);
+ ///
+ /// Specifies the display name in the listing and editing/creation
+ ///
+ ///
IAdminPropertyGenerator DisplayName(string displayName);
- IAdminPropertyGenerator Description(string description);
+
+ ///
+ /// Has the value of the property a never changing prefix that doesn't need to be specified or displayed
+ ///
+ ///
IAdminPropertyGenerator Prefix(string prefix);
+
+ ///
+ /// The specified function gets called before creation/edit to verify that the entered value matches the property requirements
+ ///
+ ///
IAdminPropertyGenerator Validator(Func validator);
+
+ ///
+ /// Sets the input type in creation/edit to a selector for the property type. The property type needs to have its own admin page in order for the selector to work!
+ ///
+ ///
IAdminPropertyGenerator IsSelector(bool selector = true);
+
+ ///
+ /// Sets the input type in creation/edit to a selector for the specified type. The specified type needs to have its own admin page in order for the selector to work!
+ ///
+ ///
+ ///
+ ///
IAdminPropertyGenerator IsSelector(bool selector = true);
+
+ ///
+ /// The specified function gets called, whenever the entry is changed/created in order to convert the raw string input to the proper property type
+ ///
+ ///
IAdminPropertyGenerator Parser(Func parser);
+
+ ///
+ /// The specified function gets called, whenever the entry is changed/created in order to convert the raw string input to the proper property type
+ ///
+ /// Needs to be specified if the field is not a plain string field (like a selector with a different type)
+ ///
IAdminPropertyGenerator Parser(Func parser);
+
+ ///
+ /// The specified function gets called, whenever the entry is changed/created in order to convert the raw string input to the proper property type
+ ///
+ /// Needs to be specified if the field is not a plain string field (like a selector with a different type)
+ /// Needs to be specified if the property type is a List
+ ///
IAdminPropertyGenerator Parser(Func parser);
+
+ ///
+ /// Specifies the default property that should be displayed as a value
+ ///
+ ///
+ ///
IAdminPropertyGenerator DisplayProperty(Expression> propertyExpression);
+
+ ///
+ /// Specifies the default property that should be displayed as a value
+ ///
+ /// Needs to be specified if the property type is a List
+ ///
IAdminPropertyGenerator DisplayProperty(Expression> propertyExpression);
}
\ No newline at end of file
diff --git a/src/HopFrame.Web.Admin/Generators/IGenerator.cs b/src/HopFrame.Web.Admin/Generators/IGenerator.cs
index 5cf9d6f..68f5013 100644
--- a/src/HopFrame.Web.Admin/Generators/IGenerator.cs
+++ b/src/HopFrame.Web.Admin/Generators/IGenerator.cs
@@ -2,6 +2,10 @@ namespace HopFrame.Web.Admin.Generators;
public interface IGenerator {
+ ///
+ /// Compiles the generator with all specified options
+ ///
+ /// The compiled data structure
TGeneratedType Compile();
}
\ No newline at end of file
diff --git a/src/HopFrame.Web.Admin/Generators/Implementation/AdminPropertyGenerator.cs b/src/HopFrame.Web.Admin/Generators/Implementation/AdminPropertyGenerator.cs
index 73767a6..d6a5792 100644
--- a/src/HopFrame.Web.Admin/Generators/Implementation/AdminPropertyGenerator.cs
+++ b/src/HopFrame.Web.Admin/Generators/Implementation/AdminPropertyGenerator.cs
@@ -61,11 +61,6 @@ internal sealed class AdminPropertyGenerator(string name, Typ
return this;
}
- public IAdminPropertyGenerator Description(string description) {
- _property.Description = description;
- return this;
- }
-
public IAdminPropertyGenerator Prefix(string prefix) {
_property.Prefix = prefix;
return this;
@@ -152,11 +147,6 @@ internal sealed class AdminPropertyGenerator(string name, Typ
var attribute = attributes.Single(a => a is AdminNameAttribute) as AdminNameAttribute;
DisplayName(attribute?.Name);
}
-
- if (attributes.Any(a => a is AdminDescriptionAttribute)) {
- var attribute = attributes.Single(a => a is AdminDescriptionAttribute) as AdminDescriptionAttribute;
- Description(attribute?.Description);
- }
if (attributes.Any(a => a is AdminBoldAttribute)) {
var attribute = attributes.Single(a => a is AdminBoldAttribute) as AdminBoldAttribute;
diff --git a/src/HopFrame.Web.Admin/Models/AdminPage.cs b/src/HopFrame.Web.Admin/Models/AdminPage.cs
index eedd4a5..748eb00 100644
--- a/src/HopFrame.Web.Admin/Models/AdminPage.cs
+++ b/src/HopFrame.Web.Admin/Models/AdminPage.cs
@@ -13,9 +13,8 @@ public class AdminPage {
public IList Properties { get; set; }
public string ListingProperty { get; set; }
- [JsonIgnore]
public Type RepositoryProvider { get; set; }
-
+
public Type ModelType { get; set; }
public string DefaultSortPropertyName { get; set; }
diff --git a/src/HopFrame.Web.Admin/Models/AdminPageProperty.cs b/src/HopFrame.Web.Admin/Models/AdminPageProperty.cs
index a86cf47..8347e36 100644
--- a/src/HopFrame.Web.Admin/Models/AdminPageProperty.cs
+++ b/src/HopFrame.Web.Admin/Models/AdminPageProperty.cs
@@ -5,7 +5,6 @@ namespace HopFrame.Web.Admin.Models;
public sealed class AdminPageProperty {
public string Name { get; set; }
public string DisplayName { get; set; }
- public string Description { get; set; }
public string Prefix { get; set; }
public string DisplayPropertyName { get; set; }
@@ -21,7 +20,6 @@ public sealed class AdminPageProperty {
public bool Selector { get; set; }
public Type SelectorType { get; set; }
- [JsonIgnore]
public Type Type { get; set; }
public Func