コード例 #1
0
        public virtual List <object> GetAnalysisDataList(Type targetObjectType)
        {
            List <object> cachedReports;

            if (analysisCache.TryGetValue(targetObjectType, out cachedReports))
            {
                return(cachedReports);
            }
            _typeInfoContainer = (ITypeInfoContainer)Application.Modules.Single(@base => @base is ITypeInfoContainer);
            using (var objectSpace = Application.CreateObjectSpace(_typeInfoContainer.TypesInfo.AnalysisType)) {
                List <string> targetObjectTypeNames = GetTargetObjectTypeNames(targetObjectType);
                var           result = new List <object>();
                if (targetObjectTypeNames.Count > 0)
                {
                    IList reports = objectSpace.CreateCollection(_typeInfoContainer.TypesInfo.AnalysisType,
                                                                 new InOperator("ObjectTypeName", targetObjectTypeNames));
                    result.AddRange(reports.Cast <object>().Select(objectSpace.GetKeyValue));
                }
                analysisCache.Add(targetObjectType, result);
                return(result);
            }
        }
コード例 #2
0
 private void EnsureCache()
 {
     if (!isCompleteCache)
     {
         IList allInPlaceDocumentsData = CollectAllInplaceDocumentsData();
         if (allInPlaceDocumentsData != null)
         {
             foreach (IDocumentData item in allInPlaceDocumentsData)
             {
                 if (item.InplaceDocumentDataSource != null)
                 {
                     List <IDocumentData> items;
                     if (!inplaceDocumentsCache.TryGetValue(item.InplaceDocumentDataSource.DataType, out items))
                     {
                         items = new List <IDocumentData>();
                         inplaceDocumentsCache[item.InplaceDocumentDataSource.DataType] = items;
                     }
                     items.Add(item);
                 }
             }
         }
         isCompleteCache = true;
     }
 }