CreateObject(Info: IMetabaseObjectCreateInfo): IMetabaseObjectDescriptor;
Info is information about the object that is being created.
The CreateObject method creates a new object, basing on the information that is passed the Info input parameter.
This method is used to create almost all objects of the platform. In certain cases it is called automatically, for example, to create necessary child objects.
Specialized methods, that should be used instead of the CreateObject method, are implemented for creating several objects. List of objects, their class, and specialized methods are given below:
| Object | Object class | Method for object creating |
| Global parameters | KE_CLASS_SHAREDPARAMS | ISpecialObjects.Operation |
| Custom classes container | KE_CLASS_CUSTOM_EXTENDER | ISpecialObjects.Operation |
Sub Main;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
DB: IDatabase;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE;
CrInfo.Id := "NewBD";
CrInfo.Name := "New database";
CrInfo.Parent := MB.Root;
MObj := MB.CreateObject(CrInfo).Edit;
DB := MObj As IDatabase;
DB.Authentication := AuthenticationMode.Password;
DB.DriverId := "ORCL";
DB.LogonData.ParamValue("SERVER") := "Test";
DB.LogonData.ParamValue("SCHEME") := "TestShema";
DB.UseMetabaseCredentials := True;
MObj.Save;
End Sub Main;
After executing the example a new database is created in the repository root. Data is stored on the Test server in the TestShema scheme. The password authentication is used when connecting to the database. Login and password are taken from the credentials, specified on login to the platform.
See also: