Uploaded image for project: 'S2Container.NET'
  1. S2Container.NET
  2. CONTAINERNET-137

プロパティが多いPONOをバインドすると時間がかかってしまう

XMLWordPrintable

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major Major
    • 1.3.18
    • Affects Version/s: 1.3.17
    • Component/s: S2Windows.NET
    • None

      100を越えるようなコントロールがある場合、バインドする速度が遅い。

      ユーザーより下記のようなソース提供がある

      「対策として _SetDataToControls での
      Control[] controls = _GetControls(this);
      foreach (Control control in controls) {
      を以下のようなメソッドでHashTableを使用することで
      PropertyInfo の ForEach 内のバインド処理速度の向上を
      図っています。

      private static void _GetAllControls(Control controls, Hashtable table)
      {
      foreach (Control control in controls.Controls)
      {
      if (String.Equals(control.Name.ToLower(), String.Empty) == false)

      { table.Add(control.Name.ToLower(), control); _GetAllControls(control, table); }

      }
      }

      あと、上記 Control[] controls = _GetControls(this); に加え

      object[] attributes
      = formType.GetCustomAttributes(typeof(ControlAttribute), false);

      を全てのメソッドで PropertyInfo の ForEach ループ外に
      出しています。」

            Assignee:
            fujiihiroaki fujiihiroaki
            Reporter:
            fujiihiroaki fujiihiroaki
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: