Пример #1
0
        public static Schema MixedSchema()
        {
            var inv = Partitioning.Invariant;

            var schema = new Schema("user");

            schema = schema.Publish();
            schema = schema.Update(new SchemaProperties {
                Hints = "The User"
            });

            schema = schema.AddJson(1, "my-json", inv,
                                    new JsonFieldProperties());

            schema = schema.AddAssets(2, "my-assets", inv,
                                      new AssetsFieldProperties());

            schema = schema.AddString(3, "my-string1", inv,
                                      new StringFieldProperties {
                Label = "My String1", IsRequired = true, AllowedValues = ImmutableList.Create("a", "b")
            });

            schema = schema.AddString(4, "my-string2", inv,
                                      new StringFieldProperties {
                Hints = "My String1"
            });

            schema = schema.AddNumber(5, "my-number", inv,
                                      new NumberFieldProperties {
                MinValue = 1, MaxValue = 10
            });

            schema = schema.AddBoolean(6, "my-boolean", inv,
                                       new BooleanFieldProperties());

            schema = schema.AddDateTime(7, "my-datetime", inv,
                                        new DateTimeFieldProperties {
                Editor = DateTimeFieldEditor.DateTime
            });

            schema = schema.AddDateTime(8, "my-date", inv,
                                        new DateTimeFieldProperties {
                Editor = DateTimeFieldEditor.Date
            });

            schema = schema.AddGeolocation(9, "my-geolocation", inv,
                                           new GeolocationFieldProperties());

            schema = schema.AddReferences(10, "my-references", inv,
                                          new ReferencesFieldProperties());

            schema = schema.AddTags(11, "my-tags", Partitioning.Language,
                                    new TagsFieldProperties());

            schema = schema.HideField(7);
            schema = schema.LockField(8);
            schema = schema.DisableField(9);

            return(schema);
        }