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):
- The table name for a class (attribute ClassStorage class);
- The column name for the attribute (attribute PropertyStorage for the property);
- The name of the column primary key (Primary key) for the identifier of the object data (attribute PrimaryKeyStorage class);
- Column name foreign key (Foreign key) to dependencies of the master (attribute PropertyStorage for the property);
For example, figure DB structures custom naming
:
CustomDBOwnClass
refers to tableCustomDBOwn
;CustomDBOwnClass.CustomOwnAttribute
refers to the column in the tableCustomOwn
CustomDBOwn
;CustomDBMasterClass
refers to tableCustomDBMaster
;CustomDBMasterClass.CustomMasterAttribute
refers to the column in the table CustomMasterCustomDBOwnCustomDBMaster
;- Attitude
CustomDBOwnClass
toCustomDBMasterClass
determinedCustomDBMaster
column in the tableCustomDBOwnClass
; - The IDs of both classes are
pkey
column in the relevant tablestables
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”.