OpenDefault(Credentials: ICredentials): IMetabase;
Credentials. Credentials used on connection.
The OpenDefault method performs connection to the repository. The settings, established for the repository by default, are used when connecting.
Executing the example requires a form, a button on the form, and the MetabaseTreeList component named MetabaseTreeList1. Platform connection settings include description of the Test repository. When connecting to it, user name and the Test password are used.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
MAN: IMetabaseManager;
Def: IMetabaseDefinition;
PwdCred: IPasswordCredentials;
Begin
MB := MetabaseClass.Active;
MAN := MB.Definition.Manager;
PwdCred := MAN.Packs.Item(0).Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
Def := MAN.Definitions.FindById("Test");
PwdCred.UserName := "Test";
PwdCred.Password := "Test";
MB := Def.OpenDefault(PwdCred);
MetabaseTreeList1.Root := MB.Root;
End Sub Button1OnClick;
After executing the example, pressing the button sets the root folder of the specified repository as a root for the MetabaseTreeList1 component. The settings saved for the repository by default are set for the repository when connecting.
See also: