Пример #1
0
        private static void PopulateProperties(ExpressionFieldUI ui, ExpressionField field)
        {
            PopulateBaseProperties(ui, field);

            ui.Expression = field.Expression;
            ui.Type       = field.DisplayType;
        }
Пример #2
0
        internal static FieldUI ToUI(this Field field, DataProvider?dataProvider)
        {
            if (field is ExpressionField expressionField)
            {
                var ui = new ExpressionFieldUI
                {
                    Expression = expressionField.Expression,
                };

                PopulateProperties(ui, field);

                return(ui);
            }
            else if (field is PropertyField propertyField)
            {
                var ui = (field is CustomField customPropertyField)
                    ? new CustomPropertyFieldUI
                {
                    CustomType = customPropertyField.CustomType
                }
                    : new PropertyFieldUI();

                PopulateProperties(ui, propertyField, dataProvider);

                return(ui);
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Пример #3
0
 private static void AddAttributes(this RenderTreeBuilder builder, FormEditContext editContext, ExpressionFieldUI expressionField, ListType displayType)
 {
     builder.AddAttribute(1, nameof(BaseDisplay.Entity), editContext.Entity);
     builder.AddAttribute(2, nameof(BaseDisplay.EntityState), editContext.EntityState);
     builder.AddAttribute(3, nameof(BaseDisplay.Parent), editContext.Parent);
     builder.AddAttribute(4, nameof(BaseDisplay.Expression), expressionField.Expression);
     builder.AddAttribute(5, nameof(BaseDisplay.DisplayType), displayType);
 }