嗨。或许我有极重的RAD情结,当我第一次弄明白ASP.NET MVC架构之后,我忽然发现,RAD有了希望。大多数情况下,当你的Model不幸被修改了,不得不去修改View。而从Model到View的映射还不得不让人来处理,也就是设计时的处理。Visual studio 2008在我们第一次创建View的时候可以帮一点小忙,而修改根本就无能为力了。其实我的期望比较的现实,大概就是ObjectGrid的ASP.NET MVC版。

例如你的Model可以写成这样:

[ObjectForm(ViewStyle.Table)]
public sealed class Product
{
  [Hidden]
  
public int Id { getset; }

  [TextBox(Caption 
= "商品名称", Width = 120)]
  
public string Name { getset; }

  [DropdownList(Caption 
= "类别", ListCreator = typeof(CategoryLister))]
  
public ProductCategory Category { getset; }

  [TextBox(Caption 
= "产地", Width = 120)]
  
public string ProducingArea { getset; }

  [RadioBox(Caption 
= "单位", ListCreator = typeof(UnitLister))]
  
public string Unit { getset; }

  [EditableGrid(Caption 
= "存货量", AllowAdd = true)]
  
public IEnumerable(Stock) Stocks{ getset; }
}

[ObjectForm(ViewStyle.InRow)]
public sealed class Stock
{
  [Hidden]
  
public Product Product { getset; }

  [TextBox(Caption 
= "产品规格", Width = 120)]
  
public string Spec { getset; }

  [TextBox(Caption 
= "数量", Width = 120)]
  
public int Quanlity { getset; }

  [TextBox(Caption 
= "单价", Mask = "0.##")]
  
public double Price { getset; }

  [DatePicker(Caption 
= "入库日期")]
  
public Date Warehousing { getset; }
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2022-01-08
  • 2021-12-23
  • 2021-12-25
  • 2021-12-10
猜你喜欢
  • 2022-12-23
  • 2021-05-13
  • 2021-08-04
  • 2022-02-06
  • 2022-12-23
  • 2021-10-24
  • 2021-09-14
相关资源
相似解决方案