Example #1
0
        public FieldRegistry(TypeNameRegistry typeNameRegistry)
        {
            Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry));

            this.typeNameRegistry = typeNameRegistry;

            var types = typeof(FieldRegistry).Assembly.GetTypes().Where(x => x.BaseType == typeof(FieldProperties));

            foreach (var type in types)
            {
                RegisterField(type);
            }

            typeNameRegistry.MapObsolete(typeof(ReferencesFieldProperties), "References");
            typeNameRegistry.MapObsolete(typeof(DateTimeFieldProperties), "DateTime");
        }
Example #2
0
        public FieldRegistry(TypeNameRegistry typeNameRegistry)
        {
            Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry));

            this.typeNameRegistry = typeNameRegistry;

            Add <BooleanFieldProperties>(
                (id, name, partitioning, properties) =>
                new BooleanField(id, name, partitioning, (BooleanFieldProperties)properties));

            Add <NumberFieldProperties>(
                (id, name, partitioning, properties) =>
                new NumberField(id, name, partitioning, (NumberFieldProperties)properties));

            Add <StringFieldProperties>(
                (id, name, partitioning, properties) =>
                new StringField(id, name, partitioning, (StringFieldProperties)properties));

            Add <JsonFieldProperties>(
                (id, name, partitioning, properties) =>
                new JsonField(id, name, partitioning, (JsonFieldProperties)properties));

            Add <AssetsFieldProperties>(
                (id, name, partitioning, properties) =>
                new AssetsField(id, name, partitioning, (AssetsFieldProperties)properties));

            Add <GeolocationFieldProperties>(
                (id, name, partitioning, properties) =>
                new GeolocationField(id, name, partitioning, (GeolocationFieldProperties)properties));

            Add <ReferencesFieldProperties>(
                (id, name, partitioning, properties) =>
                new ReferencesField(id, name, partitioning, (ReferencesFieldProperties)properties));

            Add <DateTimeFieldProperties>(
                (id, name, partitioning, properties) =>
                new DateTimeField(id, name, partitioning, (DateTimeFieldProperties)properties));

            Add <TagsFieldProperties>(
                (id, name, partitioning, properties) =>
                new TagsField(id, name, partitioning, (TagsFieldProperties)properties));

            typeNameRegistry.MapObsolete(typeof(ReferencesFieldProperties), "DateTime");

            typeNameRegistry.MapObsolete(typeof(DateTimeFieldProperties), "References");
        }
Example #3
0
        public FieldRegistry(TypeNameRegistry typeNameRegistry)
        {
            Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry));

            this.typeNameRegistry = typeNameRegistry;

            RegisterField <AssetsFieldProperties>();
            RegisterField <BooleanFieldProperties>();
            RegisterField <DateTimeFieldProperties>();
            RegisterField <GeolocationFieldProperties>();
            RegisterField <JsonFieldProperties>();
            RegisterField <NumberFieldProperties>();
            RegisterField <ReferencesFieldProperties>();
            RegisterField <StringFieldProperties>();
            RegisterField <TagsFieldProperties>();

            typeNameRegistry.MapObsolete(typeof(ReferencesFieldProperties), "DateTime");
            typeNameRegistry.MapObsolete(typeof(DateTimeFieldProperties), "References");
        }
Example #4
0
        public static void Setup(TypeNameRegistry typeNameRegistry)
        {
            Guard.NotNull(typeNameRegistry, nameof(typeNameRegistry));

            var types = typeof(FieldRegistry).Assembly.GetTypes().Where(x => x.BaseType == typeof(FieldProperties));

            var supportedFields = new HashSet <Type>();

            foreach (var type in types)
            {
                if (supportedFields.Add(type))
                {
                    typeNameRegistry.Map(type);
                }
            }

            typeNameRegistry.MapObsolete(typeof(ReferencesFieldProperties), "References");
            typeNameRegistry.MapObsolete(typeof(DateTimeFieldProperties), "DateTime");
        }
Example #5
0
        public void Map(TypeNameRegistry typeNameRegistry)
        {
            var types = typeof(FieldTypeProvider).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));
                }
            }
        }