// Create connection using windows authentication.
MasterData2022LibraryConnection connection = new MasterData2022LibraryConnection("serverName", "database", true);
// Path to the created connection file.
string path = connection.ConnectionPath;
// Using this connection you can connect a project to the library.
Project project = ...
project.ConnectToLibrary(connection):
// If you use SQL authentication, you must specify userName and password:
// 1.) When creating a connection (only once):
connection = new MasterData2022LibraryConnection("serverName", "database", "user name", "password");
project.ConnectToLibrary(connection);
// 2.) When connecting to the library (always when connecting to the library):
connection = new MasterData2022LibraryConnection("serverName", "database", false);
project.ConnectToLibrary(connection, "user name", "password");