/// <summary>
        /// If you require the entire model to be populated, you can use the set populator to increase efficiency.
        /// </summary>
        public void SearchRetrieveUseSetPopulator()
        {
            var client = GetClient();

            // Create a SearchFacet, which lets us set the parameters of the search.
            SearchFacet facet = new SearchFacet();

            // Find all VariableSchemes in the Repository.
            facet.ItemTypes.Add(DdiItemType.VariableScheme);

            // Submit the search to the Repository.
            SearchResponse response = client.Search(facet);

            if (response.ReturnedResults > 0)
            {
                // The root of the item graph for this example will be a variable scheme
                var variableSchemeId = response.Results[0].CompositeId;

                var variableScheme = client.GetItem(variableSchemeId, ChildReferenceProcessing.Instantiate);

                // The SetPopulator uses only two Repository calls are needed to populate the entire item graph.
                // It will find all the children, children of children, etc within this graph of items, and populate them
                SetPopulator setPopulator = new SetPopulator(client);
                variableScheme.Accept(setPopulator);
            }
        }
Beispiel #2
0
        public static void SaveCatalogRecordXml(CatalogRecord record, string ddiFilePath)
        {
            var study = GetStudyUnit(record);

            var client    = RepositoryHelper.GetClient();
            var populator = new SetPopulator(client);

            study.Accept(populator);

            var serializer = new Ddi33Serializer();

            serializer.UseConciseBoundedDescription = true;
            serializer.SerializeFragments(ddiFilePath, study);
        }