Наследование Windows Form

Есть пара ограничений, которые имеют отношение здесь:

  1. Существует жесткое ограничение в 256 МБ на строку
  2. Строка не может быть разделена на разные узлы, что предотвращает распараллеливание

Таким образом, вы хотите избежать хранения данных от нескольких пользователей в одной строке. Таким образом, у вас не будет 1B постов в одном ряду. Тем не менее, имея 1M строк, каждая с 1000 квалификаторов должна подойти. Вы можете рассматривать классификаторы столбцов как ключи в Hashmap. В отличие от SQL или семейств столбцов, квалификаторы в каждой строке совершенно не связаны с квалификаторами в другой строке.

5
задан Peter Mortensen 17 February 2014 в 01:57
поделиться

3 ответа

The parent's InitializeComponent should be called by having your constructor call base() like this:

public YourFormName() : base()
{
    // ...
}

(Your parent Form should have a call to InitializeComponent in its constructor. You didn't take that out, did you?)

However, the road you're going down isn't one that will play nicely with the designer, as you aren't going to be able to get it to instantiate your form at design time with those parameters (you'll have to provide a parameterless constructor for it to work). You'll also run into issues where it assigns parent properties for a second time, or assigns them to be different from what you might have wanted if you use your parametered constructor in code.

Stick with just having the properties on the form rather than using a constructor with parameters. For Forms, you'll have yourself a headache.

6
ответ дан 14 December 2019 в 08:59
поделиться

В качестве альтернативы наследования здесь можно использовать фабрику для создания форм. Таким образом, ваша фабрика может установить все свойства

1
ответ дан 14 December 2019 в 08:59
поделиться

Create an interface and pass that into the constructor of the form.

interface IFormInterface
{
      //Define Properties here
}

public MyForm(IFormInterface AClass)
{
      //Set Properties here using AClass
}

Though I'm usually doing more than just setting properties when I want to do something like this, so I end up creating an abstract class for default behaviors.

0
ответ дан 14 December 2019 в 08:59
поделиться