Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

41 lines
1.3 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Infrastructure;
namespace Squidex.Domain.Apps.Entities.Schemas
{
public static class SchemaExtensions
{
public static NamedId<Guid> NamedId(this ISchemaEntity schema)
{
return new NamedId<Guid>(schema.Id, schema.Name);
}
public static string TypeName(this ISchemaEntity schema)
{
return schema.SchemaDef.Name.ToPascalCase();
}
public static string DisplayName(this ISchemaEntity schema)
{
return schema.SchemaDef.Properties.Label.WithFallback(schema.TypeName());
}
public static string TypeName(this Schema schema)
{
return schema.Name.ToPascalCase();
}
public static string DisplayName(this Schema schema)
{
return schema.Properties.Label.WithFallback(schema.TypeName());
}
}
}