IProvideAttributeTable的唯一任务是提供AttributeTable。AttributeTable包含了定义设计时外表(apperance)和行为(behavior)的元数据(metadata)属性(attribute)。

AttributeTable这个sealed的类并没有定义一个公共的构造函数。而且AttributeTable的内容对外是只读的。那么我们如何能够提供我们的AttributTable呢?

答案是使用AttributeTableBuilder(Design Pattern: Builder Pattern)。AddCustomAttributes()可用来添加新的属性。AddTable()则是将现有的AttributeTable内容全部加入到正在创建的AttributeTable之中。

当所有定义设计时外表和行为的元数据属性加入到AttributeTableBuilder之后,我们通过调用CreateTable()返回一个AttributeTable的实例。

相关文章:

  • 2021-07-21
  • 2021-09-02
  • 2021-12-11
  • 2021-12-06
  • 2021-05-08
  • 2021-06-29
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2021-06-07
  • 2021-08-08
  • 2021-10-19
  • 2021-05-30
  • 2021-07-28
  • 2021-12-08
相关资源
相似解决方案