/// <summary> /// Retrieve a specific definition from the reference data /// </summary> /// <param name="definitionTypeName">The name of the definition type</param> /// <param name="moniker">The moniker of the definition, refers to the Sitecore GUID of the item</param> /// <param name="referenceDataHost">The host URL of the reference data service</param> /// <param name="thumbprint">The thumbprint for the endpoint certificate</param> /// <returns></returns> public virtual async Task <Definition <string, string> > GetDefinition(string definitionTypeName, string moniker, string referenceDataHost, string thumbprint) { using (var client = BuildClient(referenceDataHost, thumbprint)) { try { //Build the search criteria for the definition retrieval var definitionType = await client.EnsureDefinitionTypeAsync(definitionTypeName); var criteria = new DefinitionCriteria(moniker, definitionType); var definition = await client.GetDefinitionAsync <string, string>(criteria, false); if (definition != null) { Logger.WriteLine("Definition found: {0}", definition.Key.Moniker); } else { Logger.WriteLine("No definition found with moniker: {0} of type {1}", moniker, definitionTypeName); } return(definition); } catch (Exception ex) { Logger.WriteError("Error retrieving definition", ex); } } return(null); }
private DefinitionCriteria TestCriteria() { var sut = new DefinitionCriteria(TestPipeline()); sut.UseSpecificCulture(TestCulture); return sut; }