INamedObject
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user