Unified docstrings
All checks were successful
HopFrame CI / build (push) Successful in 47s
HopFrame CI / test (push) Successful in 49s

This commit is contained in:
2026-02-23 19:54:35 +01:00
parent 6730d57771
commit d2082ef33c
11 changed files with 90 additions and 90 deletions

View File

@@ -1,10 +1,10 @@
namespace HopFrame.Core.Configuration; namespace HopFrame.Core.Configuration;
/** /// <summary>
* The configuration for the library /// The configuration for the library
*/ /// </summary>
public sealed class HopFrameConfig { public sealed class HopFrameConfig {
/** The configurations for the table repositories */ /// The configurations for the table repositories
public IList<TableConfig> Tables { get; set; } = new List<TableConfig>(); public IList<TableConfig> Tables { get; set; } = new List<TableConfig>();
internal HopFrameConfig() {} internal HopFrameConfig() {}

View File

@@ -1,40 +1,40 @@
namespace HopFrame.Core.Configuration; namespace HopFrame.Core.Configuration;
/** /// <summary>
* The configuration for a single property /// The configuration for a single property
*/ /// </summary>
public class PropertyConfig { public class PropertyConfig {
/** [GENERATED] The unique identifier for the property (usually the real property name in the model) */ /// [GENERATED] The unique identifier for the property (usually the real property name in the model)
public required string Identifier { get; init; } public required string Identifier { get; init; }
/** [GENERATED] The displayed name of the Property */ /// [GENERATED] The displayed name of the Property
public required string DisplayName { get; set; } public required string DisplayName { get; set; }
/** [GENERATED] The real type of the property */ /// [GENERATED] The real type of the property
public required Type Type { get; set; } public required Type Type { get; set; }
/** [GENERATED] The type as wich the property should be treated */ /// [GENERATED] The type as wich the property should be treated
public required PropertyType PropertyType { get; set; } public required PropertyType PropertyType { get; set; }
/** Determines if the property will appear in the table */ /// Determines if the property will appear in the table
public bool Listable { get; set; } = true; public bool Listable { get; set; } = true;
/** Determines if the table can be sorted by the property */ /// Determines if the table can be sorted by the property
public bool Sortable { get; set; } = true; public bool Sortable { get; set; } = true;
/** Determines if the table can be searched by the property */ /// Determines if the table can be searched by the property
public bool Searchable { get; set; } = true; public bool Searchable { get; set; } = true;
/** /// <summary>
* Determines if the value of the property can be edited /// Determines if the value of the property can be edited<br/>
* (if true the value can still be set during creation) /// (if true the value can still be set during creation)
*/ /// </summary>
public bool Editable { get; set; } = true; public bool Editable { get; set; } = true;
/** Determines if the property is visible in the creation or edit dialog */ /// Determines if the property is visible in the creation or edit dialog
public bool Creatable { get; set; } = true; public bool Creatable { get; set; } = true;
/** [GENERATED] The place (from left to right) that the property will appear in the table and editor */ /// [GENERATED] The place (from left to right) that the property will appear in the table and editor
public int OrderIndex { get; set; } public int OrderIndex { get; set; }
internal PropertyConfig() {} internal PropertyConfig() {}
@@ -46,45 +46,45 @@ public class PropertyConfig {
/// </summary> /// </summary>
[Flags] [Flags]
public enum PropertyType : byte { public enum PropertyType : byte {
/** Used together with another type to indicate that the value can be null */ /// Used together with another type to indicate that the value can be null
Nullable = 0b10000000, Nullable = 0b10000000,
/** Used together with another type to indicate that the property is a relation */ /// Used together with another type to indicate that the property is a relation
Relation = 0b01000000, Relation = 0b01000000,
/** Used together with another type to indicate that the value is enumerable */ /// Used together with another type to indicate that the value is enumerable
List = 0b00100000, List = 0b00100000,
/** Indicates that the value is numeric */ /// Indicates that the value is numeric
Numeric = 0x01, Numeric = 0x01,
/** Indicates that the value is a boolean */ /// Indicates that the value is a boolean
Boolean = 0x02, Boolean = 0x02,
/** Indicates that the value is a timestamp */ /// Indicates that the value is a timestamp
DateTime = 0x03, DateTime = 0x03,
/** Indicates that the value is a date */ /// Indicates that the value is a date
DateOnly = 0x04, DateOnly = 0x04,
/** Indicates that the value is a time of day */ /// Indicates that the value is a time of day
TimeOnly = 0x05, TimeOnly = 0x05,
/** Indicates that the value is a list of fixed values */ /// Indicates that the value is a list of fixed values
Enum = 0x06, Enum = 0x06,
/** Indicates that the value is a string */ /// Indicates that the value is a string
Text = 0x07, Text = 0x07,
/** Indicates that the value is an email */ /// Indicates that the value is an email
Email = 0x08, Email = 0x08,
/** Indicates that the value is a long string */ /// Indicates that the value is a long string
TextArea = 0x09, TextArea = 0x09,
/** Indicates that the value should be hidden */ /// Indicates that the value should be hidden
Password = 0x0A, Password = 0x0A,
/** Indicates that the value is a phone number */ /// Indicates that the value is a phone number
PhoneNumber = 0x0B PhoneNumber = 0x0B
} }

View File

@@ -1,31 +1,31 @@
namespace HopFrame.Core.Configuration; namespace HopFrame.Core.Configuration;
/** /// <summary>
* The configuration for a table /// The configuration for a table
*/ /// </summary>
public class TableConfig { public class TableConfig {
/** [GENERATED] The unique identifier for the table (usually the name of the model) */ /// [GENERATED] The unique identifier for the table (usually the name of the model)
public required string Identifier { get; init; } public required string Identifier { get; init; }
/** [GENERATED] The configurations for the properties of the model */ /// [GENERATED] The configurations for the properties of the model
public IList<PropertyConfig> Properties { get; set; } = new List<PropertyConfig>(); public IList<PropertyConfig> Properties { get; set; } = new List<PropertyConfig>();
/** [GENERATED] The type of the model */ /// [GENERATED] The type of the model
public required Type TableType { get; set; } public required Type TableType { get; set; }
/** [GENERATED] The type identifier for the repository */ /// [GENERATED] The type identifier for the repository
public required Type RepositoryType { get; set; } public required Type RepositoryType { get; set; }
/** [GENERATED] the url of the table page */ /// [GENERATED] the url of the table page
public required string Route { get; set; } public required string Route { get; set; }
/** [GENERATED] The displayed name of the table */ /// [GENERATED] The displayed name of the table
public required string DisplayName { get; set; } public required string DisplayName { get; set; }
/** A short description for the table */ /// A short description for the table
public string? Description { get; set; } public string? Description { get; set; }
/** [GENERATED] The place (from top to bottom) that the table will appear in on the sidebar */ /// [GENERATED] The place (from top to bottom) that the table will appear in on the sidebar
public int OrderIndex { get; set; } public int OrderIndex { get; set; }
internal TableConfig() {} internal TableConfig() {}

View File

@@ -6,11 +6,11 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
namespace HopFrame.Core.Configurators; namespace HopFrame.Core.Configurators;
/** /// <summary>
* The configurator for the <see cref="HopFrameConfig"/> /// The configurator for the <see cref="HopFrameConfig"/>
*/ /// </summary>
public class HopFrameConfigurator(HopFrameConfig config, IServiceCollection services) { public class HopFrameConfigurator(HopFrameConfig config, IServiceCollection services) {
/** The internal config that is modified */ /// The internal config that is modified
public HopFrameConfig Config { get; } = config; public HopFrameConfig Config { get; } = config;
internal IServiceCollection Services { get; } = services; internal IServiceCollection Services { get; } = services;
@@ -21,7 +21,7 @@ public class HopFrameConfigurator(HopFrameConfig config, IServiceCollection serv
/// <typeparam name="TRepository">The repository that handles the table</typeparam> /// <typeparam name="TRepository">The repository that handles the table</typeparam>
/// <typeparam name="TModel">The type of the model</typeparam> /// <typeparam name="TModel">The type of the model</typeparam>
/// <param name="configurator">The configurator for the table</param> /// <param name="configurator">The configurator for the table</param>
public HopFrameConfigurator AddRepository<TRepository, TModel>(Action<TableConfigurator<TModel>>? configurator = null) where TRepository : IHopFrameRepository where TModel : notnull { public HopFrameConfigurator AddRepository<TRepository, TModel>(Action<TableConfigurator<TModel>>? configurator = null) where TRepository : IHopFrameRepository where TModel : class {
var table = ConfigurationHelper.InitializeTable(Config, typeof(TRepository), typeof(TModel)); var table = ConfigurationHelper.InitializeTable(Config, typeof(TRepository), typeof(TModel));
Config.Tables.Add(table); Config.Tables.Add(table);
Services.TryAddScoped(typeof(TRepository)); Services.TryAddScoped(typeof(TRepository));
@@ -36,7 +36,7 @@ public class HopFrameConfigurator(HopFrameConfig config, IServiceCollection serv
/// <param name="configurator">The configurator for the table</param> /// <param name="configurator">The configurator for the table</param>
/// <typeparam name="TModel">The model of the table</typeparam> /// <typeparam name="TModel">The model of the table</typeparam>
/// <exception cref="ArgumentException">Is thrown when configuration validation fails</exception> /// <exception cref="ArgumentException">Is thrown when configuration validation fails</exception>
public HopFrameConfigurator AddTable<TModel>(TableConfig config, Action<TableConfigurator<TModel>>? configurator = null) where TModel : notnull { public HopFrameConfigurator AddTable<TModel>(TableConfig config, Action<TableConfigurator<TModel>>? configurator = null) where TModel : class {
if (typeof(TModel) != config.TableType) if (typeof(TModel) != config.TableType)
throw new ArgumentException($"Table type for table '{config.Identifier}' does not mach requested type '{typeof(TModel).Name}'!"); throw new ArgumentException($"Table type for table '{config.Identifier}' does not mach requested type '{typeof(TModel).Name}'!");

View File

@@ -2,50 +2,50 @@
namespace HopFrame.Core.Configurators; namespace HopFrame.Core.Configurators;
/** /// <summary>
* The configurator for the <see cref="PropertyConfig"/> /// The configurator for the <see cref="PropertyConfig"/>
*/ /// </summary>
public class PropertyConfigurator(PropertyConfig config) { public class PropertyConfigurator(PropertyConfig config) {
/** The internal config that is modified */ /// The internal config that is modified
public PropertyConfig Config { get; } = config; public PropertyConfig Config { get; } = config;
/** <inheritdoc cref="PropertyConfig.DisplayName" /> */ /// <inheritdoc cref="PropertyConfig.DisplayName" />
public PropertyConfigurator SetDisplayName(string displayName) { public PropertyConfigurator SetDisplayName(string displayName) {
Config.DisplayName = displayName; Config.DisplayName = displayName;
return this; return this;
} }
/** <inheritdoc cref="PropertyConfig.Listable" /> */ /// <inheritdoc cref="PropertyConfig.Listable" />
public PropertyConfigurator Listable(bool listable) { public PropertyConfigurator Listable(bool listable) {
Config.Listable = listable; Config.Listable = listable;
return this; return this;
} }
/** <inheritdoc cref="PropertyConfig.Sortable" /> */ /// <inheritdoc cref="PropertyConfig.Sortable" />
public PropertyConfigurator Sortable(bool sortable) { public PropertyConfigurator Sortable(bool sortable) {
Config.Sortable = sortable; Config.Sortable = sortable;
return this; return this;
} }
/** <inheritdoc cref="PropertyConfig.Searchable" /> */ /// <inheritdoc cref="PropertyConfig.Searchable" />
public PropertyConfigurator Searchable(bool searchable) { public PropertyConfigurator Searchable(bool searchable) {
Config.Searchable = searchable; Config.Searchable = searchable;
return this; return this;
} }
/** <inheritdoc cref="PropertyConfig.Editable" /> */ /// <inheritdoc cref="PropertyConfig.Editable" />
public PropertyConfigurator Editable(bool editable) { public PropertyConfigurator Editable(bool editable) {
Config.Editable = editable; Config.Editable = editable;
return this; return this;
} }
/** <inheritdoc cref="PropertyConfig.Creatable" /> */ /// <inheritdoc cref="PropertyConfig.Creatable" />
public PropertyConfigurator Creatable(bool creatable) { public PropertyConfigurator Creatable(bool creatable) {
Config.Creatable = creatable; Config.Creatable = creatable;
return this; return this;
} }
/** <inheritdoc cref="PropertyConfig.OrderIndex" /> */ /// <inheritdoc cref="PropertyConfig.OrderIndex" />
public PropertyConfigurator SetOrderIndex(int index) { public PropertyConfigurator SetOrderIndex(int index) {
Config.OrderIndex = index; Config.OrderIndex = index;
return this; return this;

View File

@@ -4,38 +4,38 @@ using HopFrame.Core.Helpers;
namespace HopFrame.Core.Configurators; namespace HopFrame.Core.Configurators;
/** /// <summary>
* The configurator for the <see cref="TableConfig"/> /// The configurator for the <see cref="TableConfig"/>
*/ /// </summary>
public class TableConfigurator<TModel>(TableConfig config) where TModel : notnull { public class TableConfigurator<TModel>(TableConfig config) where TModel : class {
/** The internal config that is modified */ /// The internal config that is modified
public TableConfig Config { get; } = config; public TableConfig Config { get; } = config;
/** <inheritdoc cref="TableConfig.Route"/> */ /// <inheritdoc cref="TableConfig.Route"/>
public TableConfigurator<TModel> SetRoute(string route) { public TableConfigurator<TModel> SetRoute(string route) {
Config.Route = route; Config.Route = route;
return this; return this;
} }
/** <inheritdoc cref="TableConfig.DisplayName"/> */ /// <inheritdoc cref="TableConfig.DisplayName"/>
public TableConfigurator<TModel> SetDisplayName(string displayName) { public TableConfigurator<TModel> SetDisplayName(string displayName) {
Config.DisplayName = displayName; Config.DisplayName = displayName;
return this; return this;
} }
/** <inheritdoc cref="TableConfig.Description"/> */ /// <inheritdoc cref="TableConfig.Description"/>
public TableConfigurator<TModel> SetDescription(string description) { public TableConfigurator<TModel> SetDescription(string description) {
Config.Description = description; Config.Description = description;
return this; return this;
} }
/** <inheritdoc cref="TableConfig.OrderIndex"/> */ /// <inheritdoc cref="TableConfig.OrderIndex"/>
public TableConfigurator<TModel> SetOrderIndex(int index) { public TableConfigurator<TModel> SetOrderIndex(int index) {
Config.OrderIndex = index; Config.OrderIndex = index;
return this; return this;
} }
/** Returns the configurator for a property */ /// Returns the configurator for a property
public PropertyConfigurator Property(string identifier) { public PropertyConfigurator Property(string identifier) {
var prop = Config.Properties var prop = Config.Properties
.FirstOrDefault(p => p.Identifier == identifier); .FirstOrDefault(p => p.Identifier == identifier);
@@ -46,7 +46,7 @@ public class TableConfigurator<TModel>(TableConfig config) where TModel : notnul
return new PropertyConfigurator(prop); return new PropertyConfigurator(prop);
} }
/** <inheritdoc cref="Property"/> */ /// <inheritdoc cref="Property"/>
public PropertyConfigurator Property<TProp>(Expression<Func<TModel, TProp>> propertyExpression) { public PropertyConfigurator Property<TProp>(Expression<Func<TModel, TProp>> propertyExpression) {
var propertyName = ExpressionHelper.GetPropertyInfo(propertyExpression).Name; var propertyName = ExpressionHelper.GetPropertyInfo(propertyExpression).Name;
var prop = Config.Properties.FirstOrDefault(p => p.Identifier == propertyName); var prop = Config.Properties.FirstOrDefault(p => p.Identifier == propertyName);

View File

@@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore;
namespace HopFrame.Core.EFCore; namespace HopFrame.Core.EFCore;
/** Adds useful extensions to the <see cref="HopFrameConfigurator"/> to add managed <see cref="DbContext"/> repositories */ /// Adds useful extensions to the <see cref="HopFrameConfigurator"/> to add managed <see cref="DbContext"/> repositories
public static class HopFrameConfiguratorExtensions { public static class HopFrameConfiguratorExtensions {
/// <summary> /// <summary>

View File

@@ -2,48 +2,48 @@
namespace HopFrame.Core.Repositories; namespace HopFrame.Core.Repositories;
/** The base repository that provides access to the model dataset */ /// The base repository that provides access to the model dataset
public abstract class HopFrameRepository<TModel> : IHopFrameRepository where TModel : class { public abstract class HopFrameRepository<TModel> : IHopFrameRepository where TModel : class {
/** <inheritdoc cref="LoadPageGenericAsync"/> */ /// <inheritdoc cref="LoadPageGenericAsync"/>
public abstract Task<IEnumerable<TModel>> LoadPageAsync(int page, int perPage, CancellationToken ct = default); public abstract Task<IEnumerable<TModel>> LoadPageAsync(int page, int perPage, CancellationToken ct = default);
/** <inheritdoc/> */ /// <inheritdoc/>
public abstract Task<int> CountAsync(CancellationToken ct = default); public abstract Task<int> CountAsync(CancellationToken ct = default);
/** <inheritdoc cref="SearchGenericAsync"/> */ /// <inheritdoc cref="SearchGenericAsync"/>
public abstract Task<IEnumerable<TModel>> SearchAsync(string searchTerm, int page, int perPage, CancellationToken ct = default); public abstract Task<IEnumerable<TModel>> SearchAsync(string searchTerm, int page, int perPage, CancellationToken ct = default);
/** <inheritdoc cref="CreateGenericAsync"/> */ /// <inheritdoc cref="CreateGenericAsync"/>
public abstract Task CreateAsync(TModel entry, CancellationToken ct = default); public abstract Task CreateAsync(TModel entry, CancellationToken ct = default);
/** <inheritdoc cref="UpdateGenericAsync"/> */ /// <inheritdoc cref="UpdateGenericAsync"/>
public abstract Task UpdateAsync(TModel entry, CancellationToken ct = default); public abstract Task UpdateAsync(TModel entry, CancellationToken ct = default);
/** <inheritdoc cref="DeleteGenericAsync"/> */ /// <inheritdoc cref="DeleteGenericAsync"/>
public abstract Task DeleteAsync(TModel entry, CancellationToken ct = default); public abstract Task DeleteAsync(TModel entry, CancellationToken ct = default);
/** <inheritdoc/> */ /// <inheritdoc/>
public async Task<IEnumerable> LoadPageGenericAsync(int page, int perPage, CancellationToken ct) { public async Task<IEnumerable> LoadPageGenericAsync(int page, int perPage, CancellationToken ct) {
return await LoadPageAsync(page, perPage, ct); return await LoadPageAsync(page, perPage, ct);
} }
/** <inheritdoc/> */ /// <inheritdoc/>
public async Task<IEnumerable> SearchGenericAsync(string searchTerm, int page, int perPage, CancellationToken ct) { public async Task<IEnumerable> SearchGenericAsync(string searchTerm, int page, int perPage, CancellationToken ct) {
return await SearchAsync(searchTerm, page, perPage, ct); return await SearchAsync(searchTerm, page, perPage, ct);
} }
/** <inheritdoc/> */ /// <inheritdoc/>
public Task CreateGenericAsync(object entry, CancellationToken ct) { public Task CreateGenericAsync(object entry, CancellationToken ct) {
return CreateAsync((TModel)entry, ct); return CreateAsync((TModel)entry, ct);
} }
/** <inheritdoc/> */ /// <inheritdoc/>
public Task UpdateGenericAsync(object entry, CancellationToken ct) { public Task UpdateGenericAsync(object entry, CancellationToken ct) {
return UpdateAsync((TModel)entry, ct); return UpdateAsync((TModel)entry, ct);
} }
/** <inheritdoc/> */ /// <inheritdoc/>
public Task DeleteGenericAsync(object entry, CancellationToken ct) { public Task DeleteGenericAsync(object entry, CancellationToken ct) {
return DeleteAsync((TModel)entry, ct); return DeleteAsync((TModel)entry, ct);
} }

View File

@@ -3,7 +3,7 @@
#pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do) #pragma warning disable CS1573 // Parameter has no matching param tag in the XML comment (but other parameters do)
namespace HopFrame.Core.Repositories; namespace HopFrame.Core.Repositories;
/** The generic repository that provides access to the model dataset */ /// The generic repository that provides access to the model dataset
public interface IHopFrameRepository { public interface IHopFrameRepository {
/// <summary> /// <summary>

View File

@@ -6,10 +6,10 @@ using Microsoft.Extensions.DependencyInjection;
namespace HopFrame.Core; namespace HopFrame.Core;
/** An extension class to provide access to the setup of the library */ /// An extension class to provide access to the setup of the library
public static class ServiceCollectionExtensions { public static class ServiceCollectionExtensions {
/** Configures the library using the provided configurator */ /// Configures the library using the provided configurator
public static void AddHopFrame(this IServiceCollection services, Action<HopFrameConfigurator> configurator) { public static void AddHopFrame(this IServiceCollection services, Action<HopFrameConfigurator> configurator) {
var config = new HopFrameConfig(); var config = new HopFrameConfig();
services.AddSingleton(config); services.AddSingleton(config);

View File

@@ -3,7 +3,7 @@ using HopFrame.Core.Repositories;
namespace HopFrame.Core.Services; namespace HopFrame.Core.Services;
/** A service used to access configs and repositories provided by the <see cref="HopFrameConfig"/> */ /// A service used to access configs and repositories provided by the <see cref="HopFrameConfig"/>
public interface IConfigAccessor { public interface IConfigAccessor {
/// <summary> /// <summary>