the benefits of using static class representations in application development

When loading objects almost always need to specify a view. To this may be a string name of the desired view. This involves the following challenges:

  • The existence of a representation cannot be checked at compile time.
  • When writing code there is no convenient way to choose representation from a list of all class representations.

For convenience, the classes of data objects added static properties to access all static concepts class. For each generated service class, the nested class Views, and for each view is generated by a property to access this view.

It is recommended to use these properties in any work ideas class. This allows to timely detect errors associated with the deletion or renaming of PDW submissions (this error will occur at compile time and not at run time).

Examples

Without using static properties:

View view = Information.GetView("КошкаL", typeof(Кошка));

Using static properties:

View view = Кошка.Views.КошкаL;

Example of specifying the static properties is available at https://github.com/Flexberry/FlexberryORM-DemoApp/blob/master/FlexberryORM/CDLIB/Objects/CDDA.cs.

Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru