示例#1
0
 /// <summary>
 /// Loads the AssetContractCollection from the specified Asset collection.
 /// </summary>
 /// <param name="assets"></param>
 public void Load(IEnumerable <Asset> assets)
 {
     foreach (var asset in assets)
     {
         var contract = ContractFactory.Create <T>(asset);
         Add(contract);
     }
 }
        /// <summary>
        /// Loads the document.
        /// </summary>
        /// <param name="document">The Test docuement metadata from the document library database.</param>
        /// <param name="loadDocumentBits">Whether or not to serialize the document bits along with the metadata.</param>
        public void Load(TestDocument document, bool loadDocumentBits)
        {
            DocumentContract contract = null;

            if (loadDocumentBits)
            {
                // Find the path to the actual file
                string rootPath = GlobalSettings.Items[Setting.DocumentLibraryServer];
                string location = document.TestDocumentExtension.Location;
                string fileName = document.FileName;
                string fullPath = Path.Combine(rootPath, location, fileName);
                contract = ContractFactory.Create(document, fullPath);
            }
            else
            {
                contract = ContractFactory.Create(document);
            }

            Add(contract);
        }