mirror of https://github.com/Squidex/squidex.git
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.
37 lines
1.2 KiB
37 lines
1.2 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschränkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Squidex.Infrastructure;
|
|
|
|
namespace Squidex.Domain.Apps.Core.Schemas
|
|
{
|
|
public class FieldRegistry : ITypeProvider
|
|
{
|
|
private const string Suffix = "Properties";
|
|
private const string SuffixOld = "FieldProperties";
|
|
|
|
public void Map(TypeNameRegistry typeNameRegistry)
|
|
{
|
|
var types = typeof(FieldRegistry).Assembly.GetTypes().Where(x => typeof(FieldProperties).IsAssignableFrom(x) && !x.IsAbstract);
|
|
|
|
var addedTypes = new HashSet<Type>();
|
|
|
|
foreach (var type in types)
|
|
{
|
|
if (addedTypes.Add(type))
|
|
{
|
|
typeNameRegistry.Map(type, type.TypeName(false, Suffix));
|
|
|
|
typeNameRegistry.MapObsolete(type, type.TypeName(false, SuffixOld));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|