INamedObject

This commit is contained in:
Pilzinsel64
2025-10-29 06:07:48 +01:00
parent 4922f0a516
commit 3f5153c497
4 changed files with 12 additions and 2 deletions

View File

@@ -11,6 +11,8 @@ public abstract class BaseItemHandler<TEntity, TUpdateMsg>(IApiServer server)
where TEntity : class, IDataObject
where TUpdateMsg : ApiMessage
{
protected readonly bool isNamedObjectType = typeof(TEntity).IsAssignableTo(typeof(INamedObject));
protected virtual bool RegisterGetAll => true;
protected virtual bool RegisterPost => true;
@@ -47,6 +49,8 @@ public abstract class BaseItemHandler<TEntity, TUpdateMsg>(IApiServer server)
protected virtual IQueryable<TEntity> SortEntities(IQueryable<TEntity> entities)
{
if (isNamedObjectType)
return entities.OrderBy(n => ((INamedObject)n).Name);
return entities;
}
}