the Job names for the database

There are 2 ways for definition name:

  • in Flexberry Desinger
  • C# code using attributes.

If you choose the first path, then Flexberry Desinger will generate appropriate names automatically.

You can relate data objects and attributes with any name, DB-structure](fo_storing-data-objects.html):

For example, figure DB structures custom naming:

  • CustomDBOwnClass refers to table CustomDBOwn;
  • CustomDBOwnClass.CustomOwnAttribute refers to the column in the table CustomOwn CustomDBOwn;
  • CustomDBMasterClass refers to table CustomDBMaster;
  • CustomDBMasterClass.CustomMasterAttribute refers to the column in the table CustomMaster CustomDBOwnCustomDBMaster;
  • Attitude CustomDBOwnClass to CustomDBMasterClass determined CustomDBMaster column in the table CustomDBOwnClass;
  • The IDs of both classes are pkey column in the relevant tables tables

Simply create objects and save them.

CustomDBOwnClass cdbo = new CustomDBOwnClass();
CustomDBMasterClass cdbm = new CustomDBMasterClass();
cdbm.CustomMasterAttribute = new RandomStringGenerator().Generate(200);
cdbo.CustomDBMasterClass = cdbm;
cdbo.CustomOwnAttribute = new RandomStringGenerator().Generate(200);

IDataService dataService = DataServiceProvider.DataService;
ICSSoft.STORMNET.DataObject[] objstoupd = new ICSSoft.STORMNET.DataObject[] { cdbo, cdbm };
dataService.UpdateObjects(ref objstoupd);

Console.WriteLine("OK!");

Full list of code examples Flexberry ORM is in “code Examples”.

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