Tamino API for .NET Version 8.2.2
 —  Tamino API for .NET  —

Working with URIs

The methods of a single TaminoCommand object are by default executed relative to the Tamino collection for which this TaminoCommand object was created. However, some applications have relative or absolute URIs at hand for the documents they want to manipulate. The TaminoCommand class has methods for Insert, Retrieve, Update and Delete, each of which takes a TaminoUri parameter to specify the URI explicitly. This also allows a Tamino document to be manipulated in a different collection than the collection for which this command object was originally created.

Example

...
TaminoConnection connection = new TaminoConnection ("http://myserver/tamino/mydb");
connection.Open(TaminoConnectionMode.AutoCommit);
TaminoCommand command = connection.CreateCommand("mycollection");

// relativeUri is an URI relative to the Tamino collection "mycollection" 
// in the database "http://myserver/tamino/mydb"
TaminoUri relativeUri =  new TaminoUri("./MyDocType/MyDocumentName");
TaminoDocument tamDoc = command.Retrieve(uri);

// Note that after the Retrieve call:
// tamDoc.DocType has the value "MyDocType" and 
// tamDoc.DocName has the value "MyDocumentName" 

// URI for different collection
TaminoUri absoluteUri = 
        new TaminoUri("http://myserver/tamino/mydb/mycollection2");

// this will insert the document with the name "MyDocumentName" into
// the collection "mycollection2"
TaminoResponse response = command.Insert(absoluteUri, tamDoc);
….

Similarly, an application could even execute commands in different Tamino databases. However, this has impacts on the transactional behavior: the connection object from which a TaminoCommand object was created usually defines the transactional context for the command execution. This is also true when working with TaminoUri objects as long as the TaminoUri string matches the connection string of the TaminoConnection. If the strings do not match, the command is executed in TaminoConnectionMode.AutoCommit using Tamino default transactional settings.

Top of page