Exemplo n.º 1
0
        private List<Field> CreateTestFieldCollection(Entity entity)
        {
            List<Field> fields = new List<Field>();

            AutoNumberField autoNumberField = new AutoNumberField();

            autoNumberField.Id = Guid.NewGuid();
            autoNumberField.Name = "AutoNumberField";
            autoNumberField.Label = "AutoNumber field";
            autoNumberField.PlaceholderText = "AutoNumber field placeholder text";
            autoNumberField.Description = "AutoNumber field description";
            autoNumberField.HelpText = "AutoNumber field help text";
            autoNumberField.Required = true;
            autoNumberField.Unique = true;
            autoNumberField.Searchable = true;
            autoNumberField.Auditable = true;
            autoNumberField.System = true;
            autoNumberField.DefaultValue = 0;

            autoNumberField.DisplayFormat = "A{0000}";
            autoNumberField.StartingNumber = 10;

            fields.Add(autoNumberField);

            CheckboxField checkboxField = new CheckboxField();

            checkboxField.Id = Guid.NewGuid();
            checkboxField.Name = "CheckboxField";
            checkboxField.Label = "Checkbox field";
            checkboxField.PlaceholderText = "Checkbox field placeholder text";
            checkboxField.Description = "Checkbox field description";
            checkboxField.HelpText = "Checkbox field help text";
            checkboxField.Required = true;
            checkboxField.Unique = true;
            checkboxField.Searchable = true;
            checkboxField.Auditable = true;
            checkboxField.System = true;
            checkboxField.DefaultValue = false;

            fields.Add(checkboxField);

            CurrencyField currencyField = new CurrencyField();

            currencyField.Id = Guid.NewGuid();
            currencyField.Name = "CurrencyField";
            currencyField.Label = "Currency field";
            currencyField.PlaceholderText = "Currency field placeholder text";
            currencyField.Description = "Currency field description";
            currencyField.HelpText = "Currency field help text";
            currencyField.Required = true;
            currencyField.Unique = true;
            currencyField.Searchable = true;
            currencyField.Auditable = true;
            currencyField.System = true;
            currencyField.DefaultValue = 0;

            currencyField.MinValue = 1;
            currencyField.MaxValue = 35;
            currencyField.Currency = new CurrencyType();
            currencyField.Currency.Name = "US Dollar";
            currencyField.Currency.NamePlural = "US Dollars";
            currencyField.Currency.Symbol = "$";
            currencyField.Currency.SymbolNative = "$";
            currencyField.Currency.SymbolPlacement = CurrencySymbolPlacement.Before;
            currencyField.Currency.Code = "USD";
            currencyField.Currency.DecimalDigits = 2;
            currencyField.Currency.Rounding = 0;

            fields.Add(currencyField);

            DateField dateField = new DateField();

            dateField.Id = Guid.NewGuid();
            dateField.Name = "DateField";
            dateField.Label = "Date field";
            dateField.PlaceholderText = "Date field placeholder text";
            dateField.Description = "Date field description";
            dateField.HelpText = "Date field help text";
            dateField.Required = true;
            dateField.Unique = true;
            dateField.Searchable = true;
            dateField.Auditable = true;
            dateField.System = true;
            dateField.DefaultValue = DateTime.MinValue;

            dateField.Format = "dd MMM yyyy";

            fields.Add(dateField);

            DateTimeField dateTimeField = new DateTimeField();

            dateTimeField.Id = Guid.NewGuid();
            dateTimeField.Name = "DateTimeField";
            dateTimeField.Label = "DateTime field";
            dateTimeField.PlaceholderText = "DateTime field placeholder text";
            dateTimeField.Description = "DateTime field description";
            dateTimeField.HelpText = "DateTime field help text";
            dateTimeField.Required = true;
            dateTimeField.Unique = true;
            dateTimeField.Searchable = true;
            dateTimeField.Auditable = true;
            dateTimeField.System = true;
            dateTimeField.DefaultValue = DateTime.MinValue;

            dateTimeField.Format = "dd MMM yyyy HH:mm";

            fields.Add(dateTimeField);

            EmailField emailField = new EmailField();

            emailField.Id = Guid.NewGuid();
            emailField.Name = "EmailField";
            emailField.Label = "Email field";
            emailField.PlaceholderText = "Email field placeholder text";
            emailField.Description = "Email field description";
            emailField.HelpText = "Email field help text";
            emailField.Required = true;
            emailField.Unique = true;
            emailField.Searchable = true;
            emailField.Auditable = true;
            emailField.System = true;
            emailField.DefaultValue = "";

            emailField.MaxLength = 255;

            fields.Add(emailField);

            FileField fileField = new FileField();

            fileField.Id = Guid.NewGuid();
            fileField.Name = "FileField";
            fileField.Label = "File field";
            fileField.PlaceholderText = "File field placeholder text";
            fileField.Description = "File field description";
            fileField.HelpText = "File field help text";
            fileField.Required = true;
            fileField.Unique = true;
            fileField.Searchable = true;
            fileField.Auditable = true;
            fileField.System = true;
            fileField.DefaultValue = "";

            fields.Add(fileField);

            //FormulaField formulaField = new FormulaField();

            //formulaField.Id = Guid.NewGuid();
            //formulaField.Name = "Formula field";
            //formulaField.Label = "Formula field";
            //formulaField.PlaceholderText = "Formula field placeholder text";
            //formulaField.Description = "Formula field description";
            //formulaField.HelpText = "Formula field help text";
            //formulaField.Required = true;
            //formulaField.Unique = true;
            //formulaField.Searchable = true;
            //formulaField.Auditable = true;
            //formulaField.System = true;

            //formulaField.ReturnType = Api.FormulaFieldReturnType.Number;
            //formulaField.FormulaText = "2 + 5";
            //formulaField.DecimalPlaces = 2;

            //fields.Add(formulaField);

            HtmlField htmlField = new HtmlField();

            htmlField.Id = Guid.NewGuid();
            htmlField.Name = "HtmlField";
            htmlField.Label = "Html field";
            htmlField.PlaceholderText = "Html field placeholder text";
            htmlField.Description = "Html field description";
            htmlField.HelpText = "Html field help text";
            htmlField.Required = true;
            htmlField.Unique = true;
            htmlField.Searchable = true;
            htmlField.Auditable = true;
            htmlField.System = true;
            htmlField.DefaultValue = "";

            fields.Add(htmlField);

            ImageField imageField = new ImageField();

            imageField.Id = Guid.NewGuid();
            imageField.Name = "ImageField";
            imageField.Label = "Image field";
            imageField.PlaceholderText = "Image field placeholder text";
            imageField.Description = "Image field description";
            imageField.HelpText = "Image field help text";
            imageField.Required = true;
            imageField.Unique = true;
            imageField.Searchable = true;
            imageField.Auditable = true;
            imageField.System = true;
            imageField.DefaultValue = "";

            fields.Add(imageField);

            MultiLineTextField multiLineTextField = new MultiLineTextField();

            multiLineTextField.Id = Guid.NewGuid();
            multiLineTextField.Name = "MultiLineTextField";
            multiLineTextField.Label = "MultiLineText field";
            multiLineTextField.PlaceholderText = "MultiLineText field placeholder text";
            multiLineTextField.Description = "MultiLineText field description";
            multiLineTextField.HelpText = "MultiLineText field help text";
            multiLineTextField.Required = true;
            multiLineTextField.Unique = true;
            multiLineTextField.Searchable = true;
            multiLineTextField.Auditable = true;
            multiLineTextField.System = true;
            multiLineTextField.DefaultValue = "";

            multiLineTextField.MaxLength = 500;
            multiLineTextField.VisibleLineNumber = 10;

            fields.Add(multiLineTextField);

            MultiSelectField multiSelectField = new MultiSelectField();

            multiSelectField.Id = Guid.NewGuid();
            multiSelectField.Name = "MultiSelectField";
            multiSelectField.Label = "MultiSelect field";
            multiSelectField.PlaceholderText = "MultiSelect field placeholder text";
            multiSelectField.Description = "MultiSelect field description";
            multiSelectField.HelpText = "MultiSelect field help text";
            multiSelectField.Required = true;
            multiSelectField.Unique = true;
            multiSelectField.Searchable = true;
            multiSelectField.Auditable = true;
            multiSelectField.System = true;
            multiSelectField.DefaultValue = new string[] { "itemKey1", "itemKey4" };

            multiSelectField.Options = new List<MultiSelectFieldOption>();
            multiSelectField.Options.Add(new MultiSelectFieldOption("itemKey1", "itemValue1"));
            multiSelectField.Options.Add(new MultiSelectFieldOption("itemKey2", "itemValue2"));
            multiSelectField.Options.Add(new MultiSelectFieldOption("itemKey3", "itemValue3"));
            multiSelectField.Options.Add(new MultiSelectFieldOption("itemKey4", "itemValue4"));
            multiSelectField.Options.Add(new MultiSelectFieldOption("itemKey5", "itemValue5"));
            multiSelectField.Options.Add(new MultiSelectFieldOption("itemKey6", "itemValue6"));

            fields.Add(multiSelectField);

            NumberField numberField = new NumberField();

            numberField.Id = Guid.NewGuid();
            numberField.Name = "NumberField";
            numberField.Label = "Number field";
            numberField.PlaceholderText = "Number field placeholder text";
            numberField.Description = "Number field description";
            numberField.HelpText = "Number field help text";
            numberField.Required = true;
            numberField.Unique = true;
            numberField.Searchable = true;
            numberField.Auditable = true;
            numberField.System = true;
            numberField.DefaultValue = 0;

            numberField.MinValue = 1;
            numberField.MaxValue = 100;
            numberField.DecimalPlaces = 3;

            fields.Add(numberField);

            PasswordField passwordField = new PasswordField();

            passwordField.Id = Guid.NewGuid();
            passwordField.Name = "PasswordField";
            passwordField.Label = "Password field";
            passwordField.PlaceholderText = "Password field placeholder text";
            passwordField.Description = "Password field description";
            passwordField.HelpText = "Password field help text";
            passwordField.Required = true;
            passwordField.Unique = true;
            passwordField.Searchable = true;
            passwordField.Auditable = true;
            passwordField.System = true;

            passwordField.MaxLength = 24;
            passwordField.MinLength = 6;

            fields.Add(passwordField);

            PercentField percentField = new PercentField();

            percentField.Id = Guid.NewGuid();
            percentField.Name = "PercentField";
            percentField.Label = "Percent field";
            percentField.PlaceholderText = "Percent field";
            percentField.Description = "Percent field description";
            percentField.HelpText = "Percent field help text";
            percentField.Required = true;
            percentField.Unique = true;
            percentField.Searchable = true;
            percentField.Auditable = true;
            percentField.System = true;
            percentField.DefaultValue = 0;

            percentField.MinValue = 1;
            percentField.MaxValue = 100;
            percentField.DecimalPlaces = 3;

            fields.Add(percentField);

            PhoneField phoneField = new PhoneField();

            phoneField.Id = Guid.NewGuid();
            phoneField.Name = "PhoneField";
            phoneField.Label = "Phone field";
            phoneField.PlaceholderText = "Phone field";
            phoneField.Description = "Phone field description";
            phoneField.HelpText = "Phone field help text";
            phoneField.Required = true;
            phoneField.Unique = true;
            phoneField.Searchable = true;
            phoneField.Auditable = true;
            phoneField.System = true;
            phoneField.DefaultValue = "";

            phoneField.Format = "{0000}-{000}-{000}";
            phoneField.MaxLength = 10;

            fields.Add(phoneField);

            GuidField primaryKeyField = new GuidField();

            primaryKeyField.Id = Guid.NewGuid();
            primaryKeyField.Name = "PrimaryKeyField";
            primaryKeyField.Label = "PrimaryKey field";
            primaryKeyField.PlaceholderText = "PrimaryKey field placeholder text";
            primaryKeyField.Description = "PrimaryKey field description";
            primaryKeyField.HelpText = "PrimaryKey field help text";
            primaryKeyField.Required = true;
            primaryKeyField.Unique = true;
            primaryKeyField.Searchable = true;
            primaryKeyField.Auditable = true;
            primaryKeyField.System = true;
            primaryKeyField.DefaultValue = Guid.Empty;

            fields.Add(primaryKeyField);

            SelectField selectField = new SelectField();

            selectField.Id = Guid.NewGuid();
            selectField.Name = "SelectField";
            selectField.Label = "Select field";
            selectField.PlaceholderText = "Select field placeholder text";
            selectField.Description = "Select field description";
            selectField.HelpText = "Select field help text";
            selectField.Required = true;
            selectField.Unique = true;
            selectField.Searchable = true;
            selectField.Auditable = true;
            selectField.System = true;
            selectField.DefaultValue = "itemKey2";

            selectField.Options = new List<SelectFieldOption>();
            selectField.Options.Add(new SelectFieldOption("itemKey1", "itemValue1"));
            selectField.Options.Add(new SelectFieldOption("itemKey2", "itemValue2"));
            selectField.Options.Add(new SelectFieldOption("itemKey3", "itemValue3"));
            selectField.Options.Add(new SelectFieldOption("itemKey4", "itemValue4"));
            selectField.Options.Add(new SelectFieldOption("itemKey5", "itemValue5"));
            selectField.Options.Add(new SelectFieldOption("itemKey6", "itemValue6"));

            fields.Add(selectField);

            TextField textField = new TextField();

            textField.Id = Guid.NewGuid();
            textField.Name = "TextField";
            textField.Label = "Text field";
            textField.PlaceholderText = "Text field placeholder text";
            textField.Description = "Text field description";
            textField.HelpText = "Text field help text";
            textField.Required = true;
            textField.Unique = true;
            textField.Searchable = true;
            textField.Auditable = true;
            textField.System = true;
            textField.DefaultValue = "";

            textField.MaxLength = 200;

            UrlField urlField = new UrlField();

            urlField.Id = Guid.NewGuid();
            urlField.Name = "UrlField";
            urlField.Label = "Url field";
            urlField.PlaceholderText = "Url field placeholder text";
            urlField.Description = "Url field description";
            urlField.HelpText = "Url field help text";
            urlField.Required = true;
            urlField.Unique = true;
            urlField.Searchable = true;
            urlField.Auditable = true;
            urlField.System = true;
            urlField.DefaultValue = "";

            urlField.MaxLength = 200;
            urlField.OpenTargetInNewWindow = true;

            fields.Add(urlField);

            return fields;
        }
Exemplo n.º 2
0
        public FieldResponse CreateField(Guid entityId, FieldType type, Expando data, string name, string label, Guid? id = null,
                    string placeholderText = "", string helpText = "", string description = "",
                    bool system = false, bool required = false, bool unique = false, bool searchable = false, bool auditable = false)
        {
            Field field = null;

            if (data == null)
                data = new Expando();

            switch (type)
            {
                case FieldType.AutoNumberField:
                    field = new AutoNumberField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((AutoNumberField)field).DefaultValue = (decimal?)data["defaultValue"];
                    if (HasKey(data, "startingNumber") && data["startingNumber"] != null)
                        ((AutoNumberField)field).StartingNumber = (decimal?)data["startingNumber"];
                    if (HasKey(data, "displayFormat") && data["displayFormat"] != null)
                        ((AutoNumberField)field).DisplayFormat = (string)data["displayFormat"];
                    break;
                case FieldType.CheckboxField:
                    field = new CheckboxField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((CheckboxField)field).DefaultValue = (bool?)data["defaultValue"] ?? false;
                    break;
                case FieldType.CurrencyField:
                    field = new CurrencyField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((CurrencyField)field).DefaultValue = (decimal?)data["defaultValue"];
                    if (HasKey(data, "minValue") && data["minValue"] != null)
                        ((CurrencyField)field).MinValue = (decimal?)data["minValue"];
                    if (HasKey(data, "maxValue") && data["maxValue"] != null)
                        ((CurrencyField)field).MaxValue = (decimal?)data["maxValue"];
                    if (HasKey(data, "currency") && data["currency"] != null)
                    {
                        ((CurrencyField)field).Currency = (CurrencyType)data["currency"];
                    }
                    else
                    {
                        ((CurrencyField)field).Currency = new CurrencyType();
                        ((CurrencyField)field).Currency.Code = "USD";
                        ((CurrencyField)field).Currency.DecimalDigits = 2;
                        ((CurrencyField)field).Currency.Name = "US dollar";
                        ((CurrencyField)field).Currency.NamePlural = "US dollars";
                        ((CurrencyField)field).Currency.Rounding = 0;
                        ((CurrencyField)field).Currency.Symbol = "$";
                        ((CurrencyField)field).Currency.SymbolNative = "$";
                        ((CurrencyField)field).Currency.SymbolPlacement = CurrencySymbolPlacement.Before;
                        ((CurrencyField)field).DefaultValue = 1;
                    }
                    break;
                case FieldType.DateField:
                    field = new DateField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((DateField)field).DefaultValue = (DateTime?)data["defaultValue"];
                    if (HasKey(data, "format") && data["format"] != null)
                        ((DateField)field).Format = (string)data["format"];
                    if (HasKey(data, "useCurrentTimeAsDefaultValue") && data["useCurrentTimeAsDefaultValue"] != null)
                        ((DateField)field).UseCurrentTimeAsDefaultValue = (bool?)data["useCurrentTimeAsDefaultValue"];
                    break;
                case FieldType.DateTimeField:
                    field = new DateTimeField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((DateTimeField)field).DefaultValue = (DateTime?)data["defaultValue"];
                    if (HasKey(data, "format") && data["format"] != null)
                        ((DateTimeField)field).Format = (string)data["format"];
                    if (HasKey(data, "useCurrentTimeAsDefaultValue") && data["useCurrentTimeAsDefaultValue"] != null)
                        ((DateTimeField)field).UseCurrentTimeAsDefaultValue = (bool?)data["useCurrentTimeAsDefaultValue"];
                    break;
                case FieldType.EmailField:
                    field = new EmailField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((EmailField)field).DefaultValue = (string)data["defaultValue"];
                    if (HasKey(data, "maxLength") && data["maxLength"] != null)
                        ((EmailField)field).MaxLength = (int?)data["maxLength"];
                    break;
                case FieldType.FileField:
                    field = new FileField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((FileField)field).DefaultValue = (string)data["defaultValue"];
                    break;
                case FieldType.GuidField:
                    field = new GuidField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((GuidField)field).DefaultValue = (Guid?)data["defaultValue"];
                    if (HasKey(data, "generateNewId") && data["generateNewId"] != null)
                        ((GuidField)field).GenerateNewId = (bool?)data["generateNewId"];
                    break;
                case FieldType.HtmlField:
                    field = new HtmlField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((HtmlField)field).DefaultValue = (string)data["defaultValue"];
                    break;
                case FieldType.ImageField:
                    field = new ImageField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((ImageField)field).DefaultValue = (string)data["defaultValue"];
                    break;
                case FieldType.MultiLineTextField:
                    field = new MultiLineTextField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((MultiLineTextField)field).DefaultValue = (string)data["defaultValue"];
                    if (HasKey(data, "maxLength") && data["maxLength"] != null)
                        ((MultiLineTextField)field).MaxLength = (int?)data["maxLength"];
                    if (HasKey(data, "visibleLineNumber") && data["visibleLineNumber"] != null)
                        ((MultiLineTextField)field).VisibleLineNumber = (int?)data["visibleLineNumber"];
                    break;
                case FieldType.MultiSelectField:
                    field = new MultiSelectField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((MultiSelectField)field).DefaultValue = (IEnumerable<string>)data["defaultValue"];
                    if (HasKey(data, "options") && data["options"] != null)
                        ((MultiSelectField)field).Options = (List<MultiSelectFieldOption>)data["options"];
                    break;
                case FieldType.NumberField:
                    field = new NumberField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((NumberField)field).DefaultValue = (int?)data["defaultValue"];
                    if (HasKey(data, "minValue") && data["minValue"] != null)
                        ((NumberField)field).MinValue = (decimal?)data["minValue"];
                    if (HasKey(data, "maxValue") && data["maxValue"] != null)
                        ((NumberField)field).MaxValue = (decimal?)data["maxValue"];
                    if (HasKey(data, "decimalPlaces") && data["decimalPlaces"] != null)
                        ((NumberField)field).DecimalPlaces = (byte?)data["decimalPlaces"];
                    break;
                case FieldType.PasswordField:
                    field = new PasswordField();
                    if (HasKey(data, "maxLength") && data["maxLength"] != null)
                        ((PasswordField)field).MaxLength = (int?)data["maxLength"];
                    if (HasKey(data, "minLength") && data["minLength"] != null)
                        ((PasswordField)field).MinLength = (int?)data["minLength"];
                    if (HasKey(data, "encrypted") && data["encrypted"] != null)
                        ((PasswordField)field).Encrypted = (bool?)data["encrypted"];
                    break;
                case FieldType.PercentField:
                    field = new PercentField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((PercentField)field).DefaultValue = (decimal?)data["defaultValue"]; //0.01m;
                    if (HasKey(data, "minValue") && data["minValue"] != null)
                        ((PercentField)field).MinValue = (decimal?)data["minValue"];
                    if (HasKey(data, "maxValue") && data["maxValue"] != null)
                        ((PercentField)field).MaxValue = (decimal?)data["maxValue"];
                    if (HasKey(data, "decimalPlaces") && data["decimalPlaces"] != null)
                        ((PercentField)field).DecimalPlaces = (byte?)data["decimalPlaces"];
                    break;
                case FieldType.PhoneField:
                    field = new PhoneField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((PhoneField)field).DefaultValue = (string)data["defaultValue"];
                    if (HasKey(data, "format") && data["format"] != null)
                        ((PhoneField)field).Format = (string)data["format"];
                    if (HasKey(data, "maxLength") && data["maxLength"] != null)
                        ((PhoneField)field).DefaultValue = (string)data["maxLength"];
                    break;
                case FieldType.SelectField:
                    field = new SelectField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((SelectField)field).DefaultValue = (string)data["defaultValue"];
                    if (HasKey(data, "options") && data["options"] != null)
                        ((SelectField)field).Options = (List<SelectFieldOption>)data["options"];
                    break;
                case FieldType.TextField:
                    field = new TextField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((TextField)field).DefaultValue = (string)data["defaultValue"];
                    if (HasKey(data, "maxLength") && data["maxLength"] != null)
                        ((TextField)field).MaxLength = (int?)data["maxLength"];
                    break;
                case FieldType.UrlField:
                    field = new UrlField();
                    if (HasKey(data, "defaultValue") && data["defaultValue"] != null)
                        ((UrlField)field).DefaultValue = (string)data["defaultValue"];
                    if (HasKey(data, "maxLength") && data["maxLength"] != null)
                        ((UrlField)field).MaxLength = (int?)data["maxLength"];
                    if (HasKey(data, "openTargetInNewWindow") && data["openTargetInNewWindow"] != null)
                        ((UrlField)field).OpenTargetInNewWindow = (bool?)data["openTargetInNewWindow"];
                    break;
                default:
                    {
                        FieldResponse response = new FieldResponse();
                        response.Timestamp = DateTime.UtcNow;
                        response.Success = false;
                        response.Message = "Not supported field type!";
                        response.Success = false;
                        return response;
                    }
            }

            field.Id = id.HasValue && id.Value != Guid.Empty ? id.Value : Guid.NewGuid();
            field.Name = name;
            field.Label = label;
            field.PlaceholderText = placeholderText;
            field.Description = description;
            field.HelpText = helpText;
            field.Required = required;
            field.Unique = unique;
            field.Searchable = searchable;
            field.Auditable = auditable;
            field.System = system;

            return CreateField(entityId, field.MapTo<InputField>());
        }