I Was searching for ways to get the information and methods of the Team Development Section of Genexus using the SDK, things like:
I found out some classes inside the "Artech.Packages.TeamDevClient..." DLLs, but those did not come with the SDK Installation, I found those DLLs inside my Genexus 16 Installation Folder (inside ./Packages), so I'm not sure if I should use it. So my questions are:
Whithin the SDK Envinronment, can I get the information of the Team Dev Section of Genexus? for things like changesets, Genexus Server KB Name...
Can I Trigger Genexus Server Events like commits, updates and locks?
Edit:
In order to execute those operations, we obviously need to be connected to a GX Server Instance, therefore, if the Genexus Server Credentials were not set, it wont work.
That being said, how do I properly set (and get) those configurations programmatically?
I was digging up a bit on the classes and found this TeamDevelopmentData
from Artech.Architecture.Common.Services.TeamDevData.Client
, it has and overload to accept a Working Model, so I tried the following (with my genexus server credentials already configured in the Team Development Section):
TeamDevelopmentData teamDevData = new TeamDevelopmentData(UIServices.KB.CurrentModel);
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(teamDevData))
{
string name = descriptor.Name;
object value = descriptor.GetValue(teamDevData);
CommonServices.Output.AddLine(name+" = "+ value);
}
The result is that teamDevData
properties are null
. How do I properly use it?
The binaries under the Packages folder are the implementation details of the services defined in the SDK. It’s not advisable to reference any of them, as they are prone to change, and your extension will break if that happens. Our commitment to compatibility is to the GeneXus SDK.
In the SDK you can find the interfaces defined for the team development services, which will allow you to accomplish most of the use cases you mentioned. Keep in mind that some of the operations will run locally in the client KB, and others may require to request some information to the remote KB. For these later operations, the operations exposed require sending the user credentials. If your extension will run as a user interface extension, then you can use the services defined in the UI package, which takes care of requesting the credentials and sending them to the server when needed.
KnolwedgeBase kb = UIServices.KB.CurrentKB;
string remoteKBName = (string) kb.Properties.GetPropertyValue(Artech.Genexus.Common.Properties.KB.RemoteKb);
var changeLists = BLServices.TeamDevClient.GetChangelists(UIServices.KB.CurrentModel);
This operation returns a sequence of all the changelists defined, and for each one, the set of keys of all the pending commit items assigned to that changelist.
var localChanges = BLServices.TeamDevClient.GetLocalChanges(UIServices.KB.CurrentModel);
List<KBObjectHistory> objectList = …..
var data = new SendChangesData {
Comment = “Commit comment”,
Options = ExportOptions.Default,
ObjectList = objectList
};
bool result = UIServices.TeamDevelopment.SendChanges(data);
The localChanges
variable contains the sequence of history information of the current pending commits. Each history entry has a Key property, which you can use to compare with the keys of a given changelist in order to create the set of keys that are both in the local changes list and in a specific changelist.
var data = new ReceiveChangesData();
var pendingUpdate = UIServices.TeamDevClient.JustReceiveChanges(ref data);
I hope this allows you to get started. If you have any questions don’t hesitate to ask.